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