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