Use more reasonable variable names
This commit is contained in:
parent
ba93800317
commit
34bdf1ca0b
1 changed files with 12 additions and 14 deletions
26
flake.nix
26
flake.nix
|
@ -30,12 +30,12 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
machines = {
|
machineDefinitions = {
|
||||||
nixos.config = { ... }: {
|
nixos.config = { ... }: {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systems = builtins.mapAttrs (name: value: defaultMachine // value) machines;
|
machines = builtins.mapAttrs (name: value: defaultMachine // value) machineDefinitions;
|
||||||
tryFiles = import ./lib/utils/try-files.nix { inherit lib; };
|
tryFiles = import ./lib/utils/try-files.nix { inherit lib; };
|
||||||
in
|
in
|
||||||
flake-utils.lib.eachDefaultSystem (
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
@ -74,41 +74,39 @@
|
||||||
) // {
|
) // {
|
||||||
nixosConfigurations =
|
nixosConfigurations =
|
||||||
builtins.mapAttrs (
|
builtins.mapAttrs (
|
||||||
name: { system, config }: nixpkgs.lib.nixosSystem {
|
hostname: { system, config }: nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
(
|
(
|
||||||
{ pkgs, ... }@args: {
|
{ pkgs, ... }@args: {
|
||||||
config._module.args = {
|
config._module.args = {
|
||||||
hostname = name;
|
inherit hostname;
|
||||||
|
|
||||||
machineConfig = (defaultMachine.config args) //
|
machineConfig = (defaultMachine.config args) //
|
||||||
(config args) // {
|
(config args) // {
|
||||||
inherit name;
|
inherit hostname;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
sops-nix.nixosModules.sops
|
sops-nix.nixosModules.sops
|
||||||
./lib/configuration.nix
|
./lib/configuration.nix
|
||||||
(tryFiles [ ./lib/machines/${name}.nix ] ./lib/hardware/base.nix)
|
(tryFiles [ ./lib/machines/${hostname}.nix ] ./lib/hardware/base.nix)
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
systems;
|
machines;
|
||||||
|
|
||||||
homeConfigurations =
|
homeConfigurations =
|
||||||
let
|
let
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
in
|
in
|
||||||
lib.attrsets.concatMapAttrs (
|
lib.attrsets.concatMapAttrs (
|
||||||
hostname: machineDeclaration:
|
hostname: machine:
|
||||||
let
|
let
|
||||||
machine = machineDeclaration // defaultMachine // {
|
machineConfig = { ... }@args:
|
||||||
config = { ... }@args: (
|
(defaultMachine.config args) //
|
||||||
(defaultMachine.config args) //
|
(machine.config args);
|
||||||
(machineDeclaration.config args));
|
|
||||||
};
|
|
||||||
|
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit (machine) system;
|
inherit (machine) system;
|
||||||
|
@ -138,7 +136,7 @@
|
||||||
] ++ (lib.optional (userConfigPath != null) userConfigPath);
|
] ++ (lib.optional (userConfigPath != null) userConfigPath);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
(machine.config { inherit pkgs; }).users)
|
(machineConfig { inherit pkgs; }).users)
|
||||||
machines;
|
machines;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue