Still working on the flakes...

This commit is contained in:
Niten 2021-08-16 18:15:42 -07:00
parent b5f62d0459
commit 05ba61cb4e
2 changed files with 20 additions and 41 deletions

View File

@ -22,11 +22,8 @@
}
},
"hosts": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"narHash": "sha256-28zT4n5SyxcE9KI4b6RowZyMuzlZ6FIw2KE6xX8OTnA=",
"narHash": "sha256-Zbuk45B7idsdhuKwCg7ci8kKM4ts9I4Fw6huDkVZh5c=",
"path": "../fudo-hosts",
"type": "path"
},
@ -50,26 +47,11 @@
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1629033443,
"narHash": "sha256-Vo3TvQvR5hsd3incx/xOt6GFgTm651CYVauHS/irOFo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8ac785da9843aa110caeed6c912875e46a415a11",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-21.05",
"type": "indirect"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"hosts": "hosts",
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs"
}
}
},

View File

@ -10,26 +10,23 @@
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, hosts, home-manager, ... }: with builtins;
{
nixosConfigurations = listToAttrs (map (hostname:
let
hostOpts = hosts.host-configs.${hostname};
pkgs = import nixpkgs { system = hostOpts.arch; };
outputs = { nixpkgs, hosts, home-manager, ... }: with builtins; let
mapAttrs = f: m: listToAttrs
(map (k: { name = k; value = f k m.${k}; }) (attrNames m));
in {
nixosConfigurations = mapAttrs (hostname: hostOpts: let
pkgs = import nixpkgs { system = hostOpts.arch; };
in {
name = hostname;
value = pkgs.lib.nixosSystem {
system = hostOpts.arch;
modules = [
(import ./initialize.nix {
hostname = hostname;
home-manager-package = home-manager;
pkgs = pkgs;
include-secrets = true;
})
];
};
}) (attrNames hosts.host-configs));
};
in pkgs.lib.nixosSystem {
system = hostOpts.arch;
modules = [
(import ./initialize.nix {
hostname = hostname;
home-manager-package = home-manager;
pkgs = pkgs;
include-secrets = true;
})
];
}) hosts.host-configs;
};
}