forked from fediversity/fediversity
inline proxmox-template call
this did not need to go thru a separate file, as it turned out not recursive Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
This commit is contained in:
parent
ddbd7abbb2
commit
10431f42ad
4 changed files with 55 additions and 87 deletions
|
|
@ -2,14 +2,14 @@
|
||||||
config,
|
config,
|
||||||
system,
|
system,
|
||||||
modulesPath,
|
modulesPath,
|
||||||
sources ? import ../../../../npins,
|
sources ? import ../../../npins,
|
||||||
...
|
...
|
||||||
}@args:
|
}@args:
|
||||||
let
|
let
|
||||||
inherit (sources) nixpkgs;
|
inherit (sources) nixpkgs;
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
inherit (pkgs.callPackage ../../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration;
|
inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration;
|
||||||
inherit (config)
|
inherit (config)
|
||||||
nodeName
|
nodeName
|
||||||
pathToRoot
|
pathToRoot
|
||||||
|
|
@ -30,10 +30,10 @@ let
|
||||||
ipv6Address
|
ipv6Address
|
||||||
;
|
;
|
||||||
in
|
in
|
||||||
(pkgs.callPackage ../../../utils.nix { }).evalModel (
|
(pkgs.callPackage ../../utils.nix { }).evalModel (
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
imports = [ ../../common/model.nix ];
|
imports = [ ../common/model.nix ];
|
||||||
config = {
|
config = {
|
||||||
environments.default = environment: {
|
environments.default = environment: {
|
||||||
resources."operator-environment".login-shell = {
|
resources."operator-environment".login-shell = {
|
||||||
|
|
@ -7,23 +7,61 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (pkgs) system;
|
inherit (pkgs) system;
|
||||||
|
inherit (pkgs.callPackage ../../utils.nix { }) evalModel;
|
||||||
|
inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration;
|
||||||
backendPort = builtins.toString 8080;
|
backendPort = builtins.toString 8080;
|
||||||
tfBackend = fragment: {
|
tfBackend = fragment: {
|
||||||
address = "http://localhost:${backendPort}/state/${fragment}";
|
address = "http://localhost:${backendPort}/state/${fragment}";
|
||||||
};
|
};
|
||||||
template-deployment =
|
template-deployment =
|
||||||
(import ./setups/template.nix {
|
(evalModel (
|
||||||
inherit sources system modulesPath;
|
{ config, ... }:
|
||||||
config = {
|
{
|
||||||
httpBackend = tfBackend "proxmox-test/upload";
|
imports = [ ../common/model.nix ];
|
||||||
nodeName = "pve";
|
config = {
|
||||||
targetSystem = system;
|
environments.default = environment: {
|
||||||
node-name = "pve";
|
resources."operator-environment".login-shell = {
|
||||||
imageDatastoreId = "local";
|
wheel = true;
|
||||||
};
|
username = "operator";
|
||||||
}).default.tf-proxmox-template;
|
};
|
||||||
|
implementation =
|
||||||
|
{
|
||||||
|
required-resources,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
tf-proxmox-template = {
|
||||||
|
nixos-configuration = {
|
||||||
|
imports = [
|
||||||
|
(mkNixosConfiguration environment required-resources)
|
||||||
|
./shared.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
inherit system;
|
||||||
|
ssh.host = "pve";
|
||||||
|
httpBackend = tfBackend "proxmox-test/upload";
|
||||||
|
node-name = "pve";
|
||||||
|
imageDatastoreId = "local";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
options.default =
|
||||||
|
let
|
||||||
|
env = config.environments.default;
|
||||||
|
in
|
||||||
|
lib.mkOption {
|
||||||
|
type = env.resource-mapping.output-type;
|
||||||
|
default = env.deployment {
|
||||||
|
deployment-name = "default";
|
||||||
|
# normally our template is distinct, but our test cannot download build deps due to sandboxing
|
||||||
|
configuration = config."example-configuration";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)).default.tf-proxmox-template;
|
||||||
vm-deployment =
|
vm-deployment =
|
||||||
(import ./setups/vm.nix {
|
(import ./data-model.nix {
|
||||||
inherit sources system modulesPath;
|
inherit sources system modulesPath;
|
||||||
config = {
|
config = {
|
||||||
httpBackend = tfBackend "proxmox-test/nixos";
|
httpBackend = tfBackend "proxmox-test/nixos";
|
||||||
|
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
system,
|
|
||||||
modulesPath,
|
|
||||||
sources ? import ../../../../npins,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
inherit (sources) nixpkgs;
|
|
||||||
pkgs = import nixpkgs { inherit system; };
|
|
||||||
inherit (pkgs) lib;
|
|
||||||
inherit (pkgs.callPackage ../../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration;
|
|
||||||
inherit (config)
|
|
||||||
nodeName
|
|
||||||
targetSystem
|
|
||||||
httpBackend
|
|
||||||
node-name
|
|
||||||
imageDatastoreId
|
|
||||||
;
|
|
||||||
in
|
|
||||||
(pkgs.callPackage ../../../utils.nix { }).evalModel (
|
|
||||||
{ config, ... }:
|
|
||||||
{
|
|
||||||
imports = [ ../../common/model.nix ];
|
|
||||||
config = {
|
|
||||||
environments.default = environment: {
|
|
||||||
resources."operator-environment".login-shell = {
|
|
||||||
wheel = true;
|
|
||||||
username = "operator";
|
|
||||||
};
|
|
||||||
implementation =
|
|
||||||
{
|
|
||||||
required-resources,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
tf-proxmox-template = {
|
|
||||||
nixos-configuration = {
|
|
||||||
imports = [
|
|
||||||
(mkNixosConfiguration environment required-resources)
|
|
||||||
./shared.nix
|
|
||||||
];
|
|
||||||
};
|
|
||||||
system = targetSystem;
|
|
||||||
ssh = {
|
|
||||||
host = nodeName;
|
|
||||||
};
|
|
||||||
inherit
|
|
||||||
node-name
|
|
||||||
httpBackend
|
|
||||||
imageDatastoreId
|
|
||||||
;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
options.default =
|
|
||||||
let
|
|
||||||
env = config.environments.default;
|
|
||||||
in
|
|
||||||
lib.mkOption {
|
|
||||||
type = env.resource-mapping.output-type;
|
|
||||||
default = env.deployment {
|
|
||||||
deployment-name = "default";
|
|
||||||
# normally our template is distinct, but our test cannot download build deps due to sandboxing
|
|
||||||
configuration = config."example-configuration";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
sources ? import ../../../../npins,
|
sources ? import ../../../npins,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
"${sources.disko}/module.nix"
|
"${sources.disko}/module.nix"
|
||||||
../../../../infra/common/proxmox-qemu-vm.nix
|
../../../infra/common/proxmox-qemu-vm.nix
|
||||||
];
|
];
|
||||||
networking.useDHCP = false;
|
networking.useDHCP = false;
|
||||||
services.qemuGuest.enable = true;
|
services.qemuGuest.enable = true;
|
||||||
Loading…
Add table
Reference in a new issue