fix importing nixos configuration

This commit is contained in:
Jörg Thalheim 2023-05-14 17:45:40 +02:00
parent d1e5c253f0
commit bbb199b87f

View File

@ -1,8 +1,12 @@
{ lib, self, ... }:
let
collectNixosHosts = { directory }:
lib.mapAttrs'
(name: _:
entries = builtins.attrNames (builtins.readDir ./.);
configs = builtins.filter (dir: builtins.pathExists (./. + "/${dir}/configuration.nix")) entries;
in
{
flake.nixosConfigurations = lib.listToAttrs
(builtins.map
(name:
lib.nameValuePair
name
(lib.nixosSystem {
@ -15,12 +19,7 @@ let
};
};
modules = [ (directory + "/${name}/configuration.nix") ];
modules = [ (./. + "/${name}/configuration.nix") ];
}))
(builtins.readDir directory);
in
{
flake.nixosConfigurations = collectNixosHosts {
directory = ".";
};
configs);
}