diff --git a/export/nixosConfigurations.nix b/export/nixosConfigurations.nix index 8e180d9..023c980 100644 --- a/export/nixosConfigurations.nix +++ b/export/nixosConfigurations.nix @@ -1,19 +1,15 @@ -{ nixosUsers ? {}, nixosGroups ? {}, nixosModules, hmModules ? { default = {}; }, ...}@flake: { ... }@inputs: { host, ... }@imports: let - system = hostname: { namespace ? "fbs42", nixpkgs ? "nixpkgs" }: inputs.${nixpkgs}.lib.nixosSystem { +{ 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.${nixpkgs}.lib.optional (inputs ? home-manager) { - imports = [ inputs.home-manager.nixosModules.default ]; - config.home-manager = { - sharedModules = [ hmModules.default ]; - extraSpecialArgs = { inherit flake namespace; }; - }; - } + ++ [ inputs.home-manager.nixosModules.default ] + ++ [ { config.home-manager.sharedModules = [ hmModules.default ]; } ] + ++ [ { config.home-manager.extraSpecialArgs = { inherit flake namespace; }; } ] ++ builtins.attrValues nixosUsers ++ builtins.attrValues nixosGroups ; }; -in builtins.mapAttrs (name: value: assert builtins.length value == 1; system name (builtins.head value)) host +in builtins.mapAttrs (hostname: snippets: assert builtins.length snippets == 1; system hostname (builtins.head snippets)) host diff --git a/flake.lock b/flake.lock index 5999137..ea3f5dd 100644 --- a/flake.lock +++ b/flake.lock @@ -1,6 +1,64 @@ { "nodes": { - "root": {} + "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": 1763966396, + "narHash": "sha256-6eeL1YPcY1MV3DDStIDIdy/zZCDKgHdkCmsrLJFiZf0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5ae3b07d8d6527c42f17c876e404993199144b6a", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "hardware": "hardware", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } }, "root": "root", "version": 7 diff --git a/flake.nix b/flake.nix index 4c62af4..808ef2a 100644 --- a/flake.nix +++ b/flake.nix @@ -1,3 +1,12 @@ { + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + 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 ./.; }