forked from fediversity/fediversity
further purge test machines from nixops
This commit is contained in:
parent
0de70fb9d7
commit
0b11397daa
1 changed files with 16 additions and 39 deletions
|
|
@ -14,33 +14,17 @@ let
|
||||||
;
|
;
|
||||||
inherit (lib.attrsets) genAttrs;
|
inherit (lib.attrsets) genAttrs;
|
||||||
|
|
||||||
## Given a machine's name and whether it is a test VM, make a resource module,
|
## Given a machine's name, make a resource module,
|
||||||
## except for its missing provider. (Depending on the use of that resource, we
|
## except for its missing provider. (Depending on the use of that resource, we
|
||||||
## will provide a different one.)
|
## will provide a different one.)
|
||||||
makeResourceModule =
|
makeResourceModule =
|
||||||
{ vmName, isTestVm }:
|
{ vmName }:
|
||||||
{
|
{
|
||||||
_module.args = { inherit inputs; };
|
_module.args = { inherit inputs; };
|
||||||
imports =
|
imports = [
|
||||||
[
|
./common/resource.nix
|
||||||
./common/resource.nix
|
./machines/${vmName}
|
||||||
]
|
];
|
||||||
++ (
|
|
||||||
if isTestVm then
|
|
||||||
[
|
|
||||||
./test-machines/${vmName}
|
|
||||||
{
|
|
||||||
nixos.module.users.users.root.openssh.authorizedKeys.keys = [
|
|
||||||
# allow our panel vm access to the test machines
|
|
||||||
(import ../keys).panel
|
|
||||||
];
|
|
||||||
}
|
|
||||||
]
|
|
||||||
else
|
|
||||||
[
|
|
||||||
./machines/${vmName}
|
|
||||||
]
|
|
||||||
);
|
|
||||||
fediversityVm.name = vmName;
|
fediversityVm.name = vmName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -57,7 +41,6 @@ let
|
||||||
inputs.nixops4-nixos.modules.nixops4Resource.nixos
|
inputs.nixops4-nixos.modules.nixops4Resource.nixos
|
||||||
(makeResourceModule {
|
(makeResourceModule {
|
||||||
inherit vmName;
|
inherit vmName;
|
||||||
isTestVm = false;
|
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
@ -90,15 +73,15 @@ let
|
||||||
|
|
||||||
## Given a VM name, make a NixOS configuration for this machine.
|
## Given a VM name, make a NixOS configuration for this machine.
|
||||||
makeConfiguration =
|
makeConfiguration =
|
||||||
isTestVm: vmName:
|
vmName:
|
||||||
inputs.nixpkgs.lib.nixosSystem {
|
inputs.nixpkgs.lib.nixosSystem {
|
||||||
modules = [
|
modules = [
|
||||||
(makeResourceConfig { inherit vmName isTestVm; }).nixos.module
|
(makeResourceConfig { inherit vmName; }).nixos.module
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
makeVmOptions = isTestVm: vmName: {
|
makeVmOptions = vmName: {
|
||||||
inherit ((makeResourceConfig { inherit vmName isTestVm; }).fediversityVm)
|
inherit ((makeResourceConfig { inherit vmName; }).fediversityVm)
|
||||||
proxmox
|
proxmox
|
||||||
vmId
|
vmId
|
||||||
description
|
description
|
||||||
|
|
@ -116,24 +99,18 @@ let
|
||||||
listSubdirectories = path: attrNames (filterAttrs (_: type: type == "directory") (readDir path));
|
listSubdirectories = path: attrNames (filterAttrs (_: type: type == "directory") (readDir path));
|
||||||
|
|
||||||
machines = listSubdirectories ./machines;
|
machines = listSubdirectories ./machines;
|
||||||
testMachines = listSubdirectories ./test-machines;
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.lib.makeInstallerIso = import ./makeInstallerIso.nix;
|
flake.lib.makeInstallerIso = import ./makeInstallerIso.nix;
|
||||||
|
|
||||||
## - Each normal or test machine gets a NixOS configuration.
|
## - Each machine gets a NixOS configuration.
|
||||||
## - Each normal or test machine gets a VM options entry.
|
## - Each machine gets a VM options entry.
|
||||||
## - Each normal machine gets a deployment.
|
## - Each machine gets a deployment.
|
||||||
## - We add a “default” deployment with all normal machines.
|
## - We add a “default” deployment with all infra machines.
|
||||||
## - We add a “test” deployment with all test machines.
|
|
||||||
nixops4Deployments = genAttrs machines makeDeployment' // {
|
nixops4Deployments = genAttrs machines makeDeployment' // {
|
||||||
default = makeDeployment machines;
|
default = makeDeployment machines;
|
||||||
};
|
};
|
||||||
flake.nixosConfigurations =
|
flake.nixosConfigurations = genAttrs machines makeConfiguration;
|
||||||
genAttrs machines (makeConfiguration false)
|
flake.vmOptions = genAttrs machines makeVmOptions;
|
||||||
// genAttrs testMachines (makeConfiguration true);
|
|
||||||
flake.vmOptions =
|
|
||||||
genAttrs machines (makeVmOptions false)
|
|
||||||
// genAttrs testMachines (makeVmOptions true);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue