diff --git a/export/nixosConfigurations.nix b/export/nixosConfigurations.nix index e712097..8e180d9 100644 --- a/export/nixosConfigurations.nix +++ b/export/nixosConfigurations.nix @@ -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 { - 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 - ; - }; + 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/${hostname}"; })) flake.lib.schema.base) + ++ [ { config.networking.hostName = hostname; } ] + ++ [ nixosModules.default ] + ++ 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 diff --git a/flake.lock b/flake.lock index 4782076..5999137 100644 --- a/flake.lock +++ b/flake.lock @@ -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 diff --git a/flake.nix b/flake.nix index 5f5c238..4c62af4 100644 --- a/flake.nix +++ b/flake.nix @@ -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 ./.; }