Update flake.nix
This commit is contained in:
12
flake.nix
12
flake.nix
@@ -42,17 +42,21 @@
|
||||
lib = inputs.nixpkgs.lib;
|
||||
gen = import ./generator.nix { inherit inputs; };
|
||||
systemsDir = ./systems;
|
||||
isIgnoredSystemDir = name: lib.hasPrefix "_" name || lib.hasPrefix "." name;
|
||||
systemNames = lib.attrNames (lib.filterAttrs
|
||||
(name: type: type == "directory" && builtins.pathExists (systemsDir + "/${name}/cfg.nix"))
|
||||
(name: type:
|
||||
type == "directory"
|
||||
&& !isIgnoredSystemDir name
|
||||
&& builtins.pathExists (systemsDir + "/${name}/cfg.nix"))
|
||||
(builtins.readDir systemsDir));
|
||||
hostsByType = systemType:
|
||||
lib.filter
|
||||
(host: (import (systemsDir + "/${host}/cfg.nix")).syscfg.type == systemType)
|
||||
systemNames;
|
||||
generateHosts = systemType:
|
||||
builtins.listToAttrs (map
|
||||
(host: lib.nameValuePair host (gen.generate { inherit host; }))
|
||||
(hostsByType systemType));
|
||||
lib.genAttrs
|
||||
(hostsByType systemType)
|
||||
(host: gen.generate { inherit host; });
|
||||
in {
|
||||
devShells = import ./shells { inherit inputs; };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user