Compare commits
1 commit
7ad8bb3192
...
74ac2c76d3
| Author | SHA1 | Date | |
|---|---|---|---|
| 74ac2c76d3 |
3 changed files with 19 additions and 23 deletions
|
|
@ -1,19 +1,15 @@
|
|||
{ nixosUsers ? {}, nixosGroups ? {}, nixosModules, hmModules ? { default = {}; }, ...}@flake: { ... }@inputs: { host, ... }@imports: let
|
||||
host' = name: snippets: let
|
||||
system = { namespace?"fbs42", nixpkgs?"nixpkgs" }: inputs.${nixpkgs}.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake namespace; };
|
||||
modules = builtins.concatLists (map (base: builtins.attrValues (flake.lib.scan { base = "${base}/host/${name}"; })) flake.lib.schema.base)
|
||||
++ [ { config.networking.hostName = name; } ]
|
||||
++ [ nixosModules.default ]
|
||||
++ [ inputs.home-manager.nixosModules.default ]
|
||||
++ [ { config.home-manager.sharedModules = [ hmModules.default ]; } ]
|
||||
++ [ { config.home-manager.extraSpecialArgs = { inherit flake namespace; }; } ]
|
||||
++ builtins.attrValues nixosUsers
|
||||
++ builtins.attrValues nixosGroups
|
||||
;
|
||||
};
|
||||
{ nixosUsers ? {}, nixosGroups ? {}, nixosModules, hmModules ? { default = {}; }, ...}@flake: { nixpkgs, ... }@inputs: { host, ... }@imports: let
|
||||
system = hostname: { namespace?"fbs42" }: nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake namespace; };
|
||||
modules = builtins.concatLists (map (base: builtins.attrValues (flake.lib.scan { base = "${base}/host/${hostname}"; })) flake.lib.schema.base)
|
||||
++ [ { config.networking.hostName = hostname; } ]
|
||||
++ [ nixosModules.default ]
|
||||
++ [ inputs.home-manager.nixosModules.default ]
|
||||
++ [ { config.home-manager.sharedModules = [ hmModules.default ]; } ]
|
||||
++ [ { config.home-manager.extraSpecialArgs = { inherit flake namespace; }; } ]
|
||||
++ builtins.attrValues nixosUsers
|
||||
++ builtins.attrValues nixosGroups
|
||||
;
|
||||
};
|
||||
|
||||
cfg = assert builtins.length snippets == 1; builtins.head snippets;
|
||||
in system cfg;
|
||||
|
||||
in builtins.mapAttrs host' host
|
||||
in builtins.mapAttrs (hostname: snippets: assert builtins.length snippets == 1; system hostname (builtins.head snippets)) host
|
||||
|
|
|
|||
8
flake.lock
generated
8
flake.lock
generated
|
|
@ -38,16 +38,16 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1751274312,
|
||||
"narHash": "sha256-/bVBlRpECLVzjV19t5KMdMFWSwKLtb5RyXdjz3LJT+g=",
|
||||
"lastModified": 1763966396,
|
||||
"narHash": "sha256-6eeL1YPcY1MV3DDStIDIdy/zZCDKgHdkCmsrLJFiZf0=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "50ab793786d9de88ee30ec4e4c24fb4236fc2674",
|
||||
"rev": "5ae3b07d8d6527c42f17c876e404993199144b6a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-24.11",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
hardware.url = "github:nixos/nixos-hardware";
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-24.11";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue