Chore:_migrate 'machineName' to 'settings.machine.name'
This commit is contained in:
@@ -141,8 +141,8 @@
|
||||
'';
|
||||
default =
|
||||
config.clan.core.settings.directory
|
||||
+ "/machines/${config.clan.core.machineName}/facts/${fact.config._module.args.name}";
|
||||
defaultText = lib.literalExpression "\${config.clan.core.settings.directory}/machines/\${config.clan.core.machineName}/facts/\${fact.config._module.args.name}";
|
||||
+ "/machines/${config.clan.core.settings.machine.name}/facts/${fact.config._module.args.name}";
|
||||
defaultText = lib.literalExpression "\${config.clan.core.settings.directory}/machines/\${config.clan.core.settings.machine.name}/facts/\${fact.config._module.args.name}";
|
||||
};
|
||||
value = lib.mkOption {
|
||||
defaultText = lib.literalExpression "\${config.clan.core.settings.directory}/\${fact.config.path}";
|
||||
|
||||
@@ -219,10 +219,10 @@
|
||||
description = ''
|
||||
path to a fact which is generated by the generator
|
||||
'';
|
||||
defaultText = lib.literalExpression "\${config.clan.core.settings.directory}/machines/\${config.clan.core.machineName}/facts/\${fact.config.name}";
|
||||
defaultText = lib.literalExpression "\${config.clan.core.settings.directory}/machines/\${config.clan.core.settings.machine.name}/facts/\${fact.config.name}";
|
||||
default =
|
||||
config.clan.core.settings.directory
|
||||
+ "/machines/${config.clan.core.machineName}/facts/${fact.config.name}";
|
||||
+ "/machines/${config.clan.core.settings.machine.name}/facts/${fact.config.name}";
|
||||
};
|
||||
value = lib.mkOption {
|
||||
description = ''
|
||||
|
||||
@@ -16,7 +16,8 @@ let
|
||||
|
||||
containsMachine =
|
||||
parent: name: type:
|
||||
type == "directory" && containsSymlink "${parent}/${name}/machines/${config.clan.core.machineName}";
|
||||
type == "directory"
|
||||
&& containsSymlink "${parent}/${name}/machines/${config.clan.core.settings.machine.name}";
|
||||
|
||||
containsMachineOrGroups =
|
||||
name: type:
|
||||
@@ -37,7 +38,7 @@ in
|
||||
# Before we generate a secret we cannot know the path yet, so we need to set it to an empty string
|
||||
clan.core.facts.secretPathFunction =
|
||||
secret:
|
||||
config.sops.secrets.${"${config.clan.core.machineName}-${secret.config.name}"}.path
|
||||
config.sops.secrets.${"${config.clan.core.settings.machine.name}-${secret.config.name}"}.path
|
||||
or "/no-such-path";
|
||||
clan.core.facts.secretModule = "clan_cli.facts.secret_modules.sops";
|
||||
clan.core.facts.secretUploadDirectory = lib.mkDefault "/var/lib/sops-nix";
|
||||
@@ -51,7 +52,8 @@ in
|
||||
);
|
||||
|
||||
sops.age.keyFile = lib.mkIf (builtins.pathExists (
|
||||
config.clan.core.settings.directory + "/sops/secrets/${config.clan.core.machineName}-age.key/secret"
|
||||
config.clan.core.settings.directory
|
||||
+ "/sops/secrets/${config.clan.core.settings.machine.name}-age.key/secret"
|
||||
)) (lib.mkDefault "/var/lib/sops-nix/key.txt");
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ in
|
||||
"clanIcon"
|
||||
] "clanIcon has been removed. Use clan.core.icon instead.")
|
||||
|
||||
# The following options have been moved into clan.core.settings
|
||||
(lib.mkRenamedOptionModule
|
||||
[ "clan" "core" "clanDir" ]
|
||||
[
|
||||
@@ -24,6 +25,17 @@ in
|
||||
"directory"
|
||||
]
|
||||
)
|
||||
# The following options have been moved into clan.core.settings.machine
|
||||
(lib.mkRenamedOptionModule
|
||||
[ "clan" "core" "machineName" ]
|
||||
[
|
||||
"clan"
|
||||
"core"
|
||||
"settings"
|
||||
"machine"
|
||||
"name"
|
||||
]
|
||||
)
|
||||
];
|
||||
options.clan.core = {
|
||||
settings = mkOption {
|
||||
@@ -34,17 +46,26 @@ in
|
||||
'';
|
||||
type = types.submodule {
|
||||
options = {
|
||||
directory = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
# documentation.nixos.extraModules = [
|
||||
# ...
|
||||
# clan-core.nixosModules.clanCore
|
||||
# { clan.core.settings.directory = ./path/to/flake; }
|
||||
# ];
|
||||
directory = mkOption {
|
||||
type = types.path;
|
||||
description = ''
|
||||
the location of the flake repo, used to calculate the location of facts and secrets
|
||||
'';
|
||||
};
|
||||
machine = mkOption {
|
||||
default = {};
|
||||
type = types.submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "nixos";
|
||||
description = ''
|
||||
the name of the machine
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -79,13 +100,6 @@ in
|
||||
the description of the machine
|
||||
'';
|
||||
};
|
||||
machineName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "nixos";
|
||||
description = ''
|
||||
the name of the machine
|
||||
'';
|
||||
};
|
||||
clanPkgs = lib.mkOption {
|
||||
defaultText = "self.packages.${pkgs.system}";
|
||||
internal = true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
directory = config.clan.core.settings.directory;
|
||||
inherit (config.clan.core) machineName;
|
||||
machineName = config.clan.core.settings.machine.name;
|
||||
facterJson = "${directory}/machines/${machineName}/facter.json";
|
||||
hwConfig = "${directory}/machines/${machineName}/hardware-configuration.nix";
|
||||
in
|
||||
|
||||
@@ -20,7 +20,7 @@ in
|
||||
else
|
||||
(
|
||||
config.clan.core.settings.directory
|
||||
+ "/vars/per-machine/${config.clan.core.machineName}/${file.config.generatorName}/${file.config.name}/value"
|
||||
+ "/vars/per-machine/${config.clan.core.settings.machine.name}/${file.config.generatorName}/${file.config.name}/value"
|
||||
)
|
||||
);
|
||||
value = mkIf (file.config.secret == false) (
|
||||
|
||||
@@ -10,7 +10,7 @@ let
|
||||
|
||||
inherit (import ./funcs.nix { inherit lib; }) collectFiles;
|
||||
|
||||
inherit (config.clan.core) machineName;
|
||||
machineName = config.clan.core.settings.machine.name;
|
||||
|
||||
secretPath =
|
||||
secret:
|
||||
|
||||
@@ -252,7 +252,7 @@ in
|
||||
clan.core.vm.inspect = {
|
||||
clan_name = config.clan.core.name;
|
||||
machine_icon = config.clan.core.machineIcon or config.clan.core.icon;
|
||||
machine_name = config.clan.core.machineName;
|
||||
machine_name = config.clan.core.settings.machine.name;
|
||||
machine_description = config.clan.core.machineDescription;
|
||||
memory_size = config.clan.virtualisation.memorySize;
|
||||
inherit (config.clan.virtualisation) cores graphics waypipe;
|
||||
|
||||
Reference in New Issue
Block a user