Working on flake

This commit is contained in:
Niten 2021-08-06 16:30:35 -07:00
parent 5b92cefc97
commit 801d5a4cfc

View File

@ -20,13 +20,14 @@ in {
builtins.replaceStrings [ ".nix" ] [ "" ] filename; builtins.replaceStrings [ ".nix" ] [ "" ] filename;
hosts = map hostname-from-file (lib.attrNames (lib.filterAttrs is-nix-file hosts = map hostname-from-file (lib.attrNames (lib.filterAttrs is-nix-file
(lib.filterAttrs is-regular-file (builtins.readDir hosts-path)))); (lib.filterAttrs is-regular-file (builtins.readDir hosts-path))));
hostsOpts = lib.listToAttrs (hostname:
lib.nameValuePair hostname (import hosts-path + "/${hostname}.nix"));
pkgs = import nixpkgs { }; pkgs = import nixpkgs { };
in { in {
nixConfigurations = lib.mapAttrs (hostname: nixConfigurations = lib.mapAttrs (hostname: hostOpts:
let hostOpts = import hosts-path + "/${hostname}.nix"; lib.nixosSystem {
in lib.nixosSystem {
system = hostOpts.platform; system = hostOpts.platform;
modules = [ modules = [
(import ./initialize.nix { (import ./initialize.nix {
@ -36,6 +37,6 @@ in {
include-secrets = true; include-secrets = true;
}) })
]; ];
}) hosts; }) hostsOpts;
}; };
} }