File tree Expand file tree Collapse file tree 3 files changed +46
-19
lines changed
Expand file tree Collapse file tree 3 files changed +46
-19
lines changed Original file line number Diff line number Diff line change 1- { ... } :
1+ { lib , ... } :
22
3+ with lib ;
4+ let
5+ # Recursively constructs an attrset of a given folder, recursing on directories, value of attrs is the filetype
6+ getDir =
7+ dir :
8+ mapAttrs ( file : type : if type == "directory" then getDir "${ dir } /${ file } " else type ) (
9+ builtins . readDir dir
10+ ) ;
11+
12+ # Collects all files of a directory as a list of strings of paths
13+ files = dir : collect isString ( mapAttrsRecursive ( path : _ : concatStringsSep "/" path ) ( getDir dir ) ) ;
14+
15+ # Filters out directories that don't end with .nix or are this file, also makes the strings absolute
16+ validFiles =
17+ dir :
18+ map ( file : ./. + "/${ file } " ) (
19+ filter ( file : hasSuffix ".nix" file && file != "default.nix" ) ( files dir )
20+ ) ;
21+
22+ in
323{
424 imports = [
525 ../default.nix
6-
7- ./app.nix
8- ./dconf.nix
9- ./development.nix
10- ./editors.nix
11- ./gtk.nix
12- ./hyprland.nix
13- ./mpv.nix
14- ./rofi.nix
15- ./terminal.nix
16- ./xdg.nix
17- ] ;
26+ ] ++ validFiles ./. ;
1827}
Original file line number Diff line number Diff line change 1- { ... } :
1+ { lib , ... } :
22
3+ with lib ;
4+ let
5+ # Recursively constructs an attrset of a given folder, recursing on directories, value of attrs is the filetype
6+ getDir =
7+ dir :
8+ mapAttrs ( file : type : if type == "directory" then getDir "${ dir } /${ file } " else type ) (
9+ builtins . readDir dir
10+ ) ;
11+
12+ # Collects all files of a directory as a list of strings of paths
13+ files = dir : collect isString ( mapAttrsRecursive ( path : _ : concatStringsSep "/" path ) ( getDir dir ) ) ;
14+
15+ # Filters out directories that don't end with .nix or are this file, also makes the strings absolute
16+ validFiles =
17+ dir :
18+ map ( file : ./. + "/${ file } " ) (
19+ filter ( file : hasSuffix ".nix" file && file != "default.nix" ) ( files dir )
20+ ) ;
21+
22+ in
323{
424 imports = [
525 ../desktop/default.nix
6-
7- ./gaming.nix
8- ./mail.nix
9- ./video.nix
10- ] ;
26+ ] ++ validFiles ./. ;
1127}
Original file line number Diff line number Diff line change 11{
22 inputs ,
3+ lib ,
34 pkgs ,
45 pkgs-unstable ,
56 stateVersion ,
3132 ${ meta . user . username } = import ../../home-manager/home {
3233 inherit
3334 inputs
35+ lib
3436 pkgs
3537 pkgs-unstable
3638 stateVersion
You can’t perform that action at this time.
0 commit comments