···142142 inputs:
143143 let
144144 # Function to stop using `import-tree` by Vic.
145145- # Just to lighten the config a bit, written by https://codeberg.org/BANanaD3V
146146- # Adaptation stolen from @iynai
147147- inherit (inputs.nixpkgs.lib.fileset) toList fileFilter;
148148- import-tree =
149149- paths:
150150- toList (
151151- fileFilter (file: file.hasExt "nix" && !(inputs.nixpkgs.lib.hasPrefix "_" file.name)) paths
152152- );
145145+ # Just to lighten the config a bit, written by @llakala https://github.com/llakala/synaptic-standard/blob/main/demo/recursivelyImport.nix
146146+ import-tree = import ./stuff/recursivelyImport.nix { lib = inputs.nixpkgs.lib; };
153147154148 # a way to fetch nix files via nvfetcher and import them in the config
155149 # basically parse the json crated by nvfetcher, and use fetchTarball
···174168 specialArgs = { inherit modules; };
175169 }
176170 {
177177- imports = import-tree ./modules;
171171+ imports = import-tree [ ./modules ];
178172 flake.templates = import ./templates;
179173 };
180174}
install/impermanence.norg
stuff/impermanence.norg
install/zfs.norg
stuff/zfs.norg
+27
stuff/recursivelyImport.nix
···11+{ lib }:
22+let
33+ inherit (lib) hasSuffix hasPrefix;
44+ inherit (builtins)
55+ concatMap
66+ isPath
77+ filter
88+ readFileType
99+ ;
1010+1111+ expandIfFolder =
1212+ elem:
1313+ if !isPath elem || readFileType elem != "directory" then
1414+ [ elem ]
1515+ else
1616+ lib.filesystem.listFilesRecursive elem;
1717+in
1818+list:
1919+filter
2020+ # Filter out any path that doesn't look like `*.nix`. Don't forget to use
2121+ # toString to prevent copying paths to the store unnecessarily
2222+ (
2323+ elem:
2424+ !isPath elem || (hasSuffix ".nix" (toString elem) && !hasPrefix "_" (baseNameOf (toString elem)))
2525+ )
2626+ # Expand any folder to all the files within it.
2727+ (concatMap expandIfFolder list)