Compare commits

...

3 commits

Author SHA1 Message Date
72f2a2ddc0 remove inputs
We actually do not depend on any input here. Only if a
nixosConfiguration should be instantiated, but it is already
expected that the user will provide a (more up-to-date) nixpkgs
flake that we use.
2025-11-26 13:58:56 +01:00
f3f83a56ab bump version 2025-11-26 10:50:10 +01:00
a5dc014e65 make home-manager optional
As the home-manager depends on the actual used nixpkgs version
and is not always used, remove it from the base dependencies but
use still use it implictely if a home-manager input exists.
2025-11-26 03:01:08 +01:00
3 changed files with 18 additions and 85 deletions

View file

@ -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

60
flake.lock generated
View file

@ -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

View file

@ -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 ./.;
}