Compare commits
3 commits
74ac2c76d3
...
72f2a2ddc0
| Author | SHA1 | Date | |
|---|---|---|---|
| 72f2a2ddc0 | |||
| f3f83a56ab | |||
| a5dc014e65 |
3 changed files with 18 additions and 85 deletions
|
|
@ -1,19 +1,19 @@
|
|||
{ nixosUsers ? {}, nixosGroups ? {}, nixosModules, hmModules ? { default = {}; }, ...}@flake: { ... }@inputs: { host, ... }@imports: let
|
||||
host' = name: snippets: let
|
||||
system = { namespace?"fbs42", nixpkgs?"nixpkgs" }: inputs.${nixpkgs}.lib.nixosSystem {
|
||||
system = hostname: { 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; } ]
|
||||
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; }; } ]
|
||||
++ inputs.${nixpkgs}.lib.optional (inputs ? home-manager) {
|
||||
imports = [ inputs.home-manager.nixosModules.default ];
|
||||
config.home-manager = {
|
||||
sharedModules = [ hmModules.default ];
|
||||
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 (name: value: assert builtins.length value == 1; system name (builtins.head value)) host
|
||||
|
|
|
|||
60
flake.lock
generated
60
flake.lock
generated
|
|
@ -1,64 +1,6 @@
|
|||
{
|
||||
"nodes": {
|
||||
"hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1762847253,
|
||||
"narHash": "sha256-BWWnUUT01lPwCWUvS0p6Px5UOBFeXJ8jR+ZdLX8IbrU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "899dc449bc6428b9ee6b3b8f771ca2b0ef945ab9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"repo": "nixos-hardware",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1747688870,
|
||||
"narHash": "sha256-ypL9WAZfmJr5V70jEVzqGjjQzF0uCkz+AFQF7n9NmNc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "d5f1f641b289553927b3801580598d200a501863",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-24.11",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1751274312,
|
||||
"narHash": "sha256-/bVBlRpECLVzjV19t5KMdMFWSwKLtb5RyXdjz3LJT+g=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "50ab793786d9de88ee30ec4e4c24fb4236fc2674",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-24.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"hardware": "hardware",
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
"root": {}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
|
|
|
|||
|
|
@ -1,12 +1,3 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
hardware.url = "github:nixos/nixos-hardware";
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-24.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, ... }@inputs: import ./lib/flake.nix inputs ./.;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue