Grant machine configs access to the pkgs attribute

This commit is contained in:
Manuel Thalmann 2024-05-07 21:59:58 +02:00
parent a4cedd467f
commit bdea1aa785

View file

@ -44,47 +44,48 @@
) // { ) // {
nixosConfigurations = nixosConfigurations =
let let
default = { default = { pkgs, ... }: {
dualBoot = false; dualBoot = false;
timeZone = null; timeZone = null;
keyMap = "us"; keyMap = "us";
keyboardLayout = "us"; keyboardLayout = "us";
localeSettings = { }; localeSettings = { };
}; };
systems = [ systems = {
{ nixos.config = { ... }: {
name = "nixos"; };
} };
];
in in
builtins.listToAttrs ( builtins.mapAttrs (
builtins.map ( name: { system ? "x86_64-linux", config }: nixpkgs.lib.nixosSystem {
{ name, system ? "x86_64-linux", ... }@config: { inherit system;
inherit name;
value = nixpkgs.lib.nixosSystem { modules = [
inherit system; (
{ pkgs, ... }@args: {
modules = [ config._module.args = {
({ ... }: { config._module.args = { machineConfig = default // config; }; }) machineConfig = (default args) //
sops-nix.nixosModules.sops (config args) // {
./lib/configuration.nix inherit name;
};
( };
let })
configCandidate = ./lib/machines/${name}.nix; sops-nix.nixosModules.sops
./lib/configuration.nix
machineConfigPath = (
if builtins.pathExists configCandidate let
then configCandidate = ./lib/machines/${name}.nix;
configCandidate
else machineConfigPath =
./lib/hardware/base.nix; if builtins.pathExists configCandidate
in then
machineConfigPath) configCandidate
]; else
}; ./lib/hardware/base.nix;
}) in
systems); machineConfigPath)
];
})
systems;
}); });
} }