Something went wrong. Try again.
testing nosh
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556# forked from https://codeberg.org/poacher/nosh# it's a small script to make hosts out of modulesnixpkgs: pkgs:let inherit (pkgs.lib) concatMap hasSuffix hasPrefix; inherit (builtins) attrNames readDir; listNixFilesRecursive = folder: let contents = readDir folder; in concatMap ( filename: let type = contents.${filename}; in if type == "regular" && hasSuffix ".nix" filename && !hasPrefix "_" filename then [ (folder + "/${filename}") ] else if type == "directory" then listNixFilesRecursive (folder + "/${filename}") else [ ] ) (attrNames contents);in{ conditions ? _: true, paths ? [ ], modules ? [ ], eval ? import "${nixpkgs}/nixos/lib/eval-config.nix", pkgs ? import <nixpkgs> { }, specialArgs ? { },}:eval { inherit specialArgs; modules = [ { nixpkgs.pkgs = pkgs; } ] ++ modules ++ map ( path: let module = import path; in if (module.enable or true) && module ? config && conditions module then pkgs.lib.setDefaultModuleLocation (toString path) module.config else { } ) ( # Expand any folder to all the files within it. concatMap listNixFilesRecursive paths );}