remove nixpkgs overwrite #7

Merged
nonapode merged 1 commit from nonapode/remove-nixpkgs-overwrite into main 2025-11-26 18:47:32 +01:00
3 changed files with 18 additions and 63 deletions

View file

@ -1,23 +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.${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
;
};
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

38
flake.lock generated
View file

@ -1,42 +1,6 @@
{
"nodes": {
"hardware": {
"locked": {
"lastModified": 1764080039,
"narHash": "sha256-b1MtLQsQc4Ji1u08f+C6g5XrmLPkJQ1fhNkCt+0AERQ=",
"owner": "nixos",
"repo": "nixos-hardware",
"rev": "da17006633ca9cda369be82893ae36824a2ddf1a",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixos-hardware",
"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",
"nixpkgs": "nixpkgs"
}
}
"root": {}
},
"root": "root",
"version": 7

View file

@ -1,8 +1,3 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
hardware.url = "github:nixos/nixos-hardware";
};
outputs = { self, ... }@inputs: import ./lib/flake.nix inputs ./.;
}