forked from fediversity/fediversity
Compare commits
4 commits
464c7adc70
...
da8b6bac41
| Author | SHA1 | Date | |
|---|---|---|---|
| da8b6bac41 | |||
| 4049ca8156 | |||
| 40e8a0a3c5 | |||
| f954ed5389 |
9 changed files with 204 additions and 11 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch: # allows manual triggering
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
|
|
@ -39,6 +40,12 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: nix-build -A tests.panel
|
- run: nix-build -A tests.panel
|
||||||
|
|
||||||
|
check-proxmox-basic:
|
||||||
|
runs-on: native
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: nix build .#checks.x86_64-linux.proxmox-basic -L
|
||||||
|
|
||||||
check-deployment-basic:
|
check-deployment-basic:
|
||||||
runs-on: native
|
runs-on: native
|
||||||
steps:
|
steps:
|
||||||
|
|
|
||||||
37
deployment/check/proxmox/default.nix
Normal file
37
deployment/check/proxmox/default.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
runNixOSTest,
|
||||||
|
sources,
|
||||||
|
system,
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
pkgs = import sources.nixpkgs-stable {
|
||||||
|
inherit system;
|
||||||
|
overlays = [ overlay ];
|
||||||
|
};
|
||||||
|
overlay = _: _: {
|
||||||
|
inherit
|
||||||
|
(import "${sources.proxmox-nixos}/pkgs" {
|
||||||
|
craneLib = pkgs.callPackage "${sources.crane}/lib" { };
|
||||||
|
# breaks from https://github.com/NixOS/nixpkgs/commit/06b354eb2dc535c57e9b4caaa16d79168f117a26,
|
||||||
|
# which updates libvncserver to 0.9.15, which was not yet patched at https://git.proxmox.com/?p=vncterm.git.
|
||||||
|
inherit pkgs;
|
||||||
|
# not so picky about version for our purposes
|
||||||
|
pkgs-unstable = pkgs;
|
||||||
|
})
|
||||||
|
proxmox-ve
|
||||||
|
pve-ha-manager
|
||||||
|
;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
runNixOSTest {
|
||||||
|
node.specialArgs = {
|
||||||
|
inherit
|
||||||
|
sources
|
||||||
|
pkgs
|
||||||
|
;
|
||||||
|
};
|
||||||
|
imports = [
|
||||||
|
./proxmoxTest.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
87
deployment/check/proxmox/proxmoxTest.nix
Normal file
87
deployment/check/proxmox/proxmoxTest.nix
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
# https://github.com/SaumonNet/proxmox-nixos/blob/main/tests/vm.nix
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
# tracking non-tarball downloads seems unsupported still in npins:
|
||||||
|
# https://github.com/andir/npins/issues/163
|
||||||
|
minimalIso = pkgs.fetchurl {
|
||||||
|
url = "https://releases.nixos.org/nixos/24.05/nixos-24.05.7139.bcba2fbf6963/nixos-minimal-24.05.7139.bcba2fbf6963-x86_64-linux.iso";
|
||||||
|
hash = "sha256-plre/mIHdIgU4xWU+9xErP+L4i460ZbcKq8iy2n4HT8=";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
name = "proxmox-basic";
|
||||||
|
|
||||||
|
nodes.mypve =
|
||||||
|
{ sources, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
"${sources.proxmox-nixos}/modules/proxmox-ve"
|
||||||
|
];
|
||||||
|
services.proxmox-ve = {
|
||||||
|
enable = true;
|
||||||
|
ipAddress = "192.168.1.1";
|
||||||
|
vms = {
|
||||||
|
myvm1 = {
|
||||||
|
vmid = 100;
|
||||||
|
memory = 1024;
|
||||||
|
cores = 1;
|
||||||
|
sockets = 1;
|
||||||
|
kvm = true;
|
||||||
|
scsi = [ { file = "local:16"; } ];
|
||||||
|
cdrom = "local:iso/minimal.iso";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
virtualisation = {
|
||||||
|
additionalPaths = [ minimalIso ];
|
||||||
|
diskSize = 4096;
|
||||||
|
memorySize = 2048;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
machine.start()
|
||||||
|
machine.wait_for_unit("pveproxy.service")
|
||||||
|
assert "running" in machine.succeed("pveproxy status")
|
||||||
|
|
||||||
|
# Copy Iso
|
||||||
|
machine.succeed("mkdir -p /var/lib/vz/template/iso/")
|
||||||
|
machine.succeed("cp ${minimalIso} /var/lib/vz/template/iso/minimal.iso")
|
||||||
|
|
||||||
|
# Declarative VM creation
|
||||||
|
machine.wait_for_unit("multi-user.target")
|
||||||
|
machine.succeed("qm stop 100 --timeout 0")
|
||||||
|
|
||||||
|
# Seabios VM creation
|
||||||
|
machine.succeed(
|
||||||
|
"qm create 101 --kvm 0 --bios seabios -cdrom local:iso/minimal.iso",
|
||||||
|
"qm start 101",
|
||||||
|
"qm stop 101 --timeout 0"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Legacy ovmf vm creation
|
||||||
|
machine.succeed(
|
||||||
|
"qm create 102 --kvm 0 --bios ovmf -cdrom local:iso/minimal.iso",
|
||||||
|
"qm start 102",
|
||||||
|
"qm stop 102 --timeout 0"
|
||||||
|
)
|
||||||
|
|
||||||
|
# UEFI ovmf vm creation
|
||||||
|
machine.succeed(
|
||||||
|
"qm create 103 --kvm 0 --bios ovmf --efidisk0 local:4,efitype=4m -cdrom local:iso/minimal.iso",
|
||||||
|
"qm start 103",
|
||||||
|
"qm stop 103 --timeout 0"
|
||||||
|
)
|
||||||
|
|
||||||
|
# UEFI ovmf vm creation with secure boot
|
||||||
|
machine.succeed(
|
||||||
|
"qm create 104 --kvm 0 --bios ovmf --efidisk0 local:4,efitype=4m,pre-enrolled-keys=1 -cdrom local:iso/minimal.iso",
|
||||||
|
"qm start 104",
|
||||||
|
"qm stop 104 --timeout 0"
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
@ -13,7 +13,6 @@ let
|
||||||
./data-model.nix
|
./data-model.nix
|
||||||
];
|
];
|
||||||
}).config;
|
}).config;
|
||||||
nixops4Deployment = inputs.nixops4.modules.nixops4Deployment.default;
|
|
||||||
inherit (inputs.nixops4.lib) mkDeployment;
|
inherit (inputs.nixops4.lib) mkDeployment;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
@ -32,7 +31,7 @@ in
|
||||||
expr =
|
expr =
|
||||||
let
|
let
|
||||||
fediversity = eval (
|
fediversity = eval (
|
||||||
{ config, ... }:
|
{ config, options, ... }:
|
||||||
{
|
{
|
||||||
config = {
|
config = {
|
||||||
resources.login-shell = {
|
resources.login-shell = {
|
||||||
|
|
@ -112,7 +111,7 @@ in
|
||||||
resources.operator-environment.login-shell.username = "operator";
|
resources.operator-environment.login-shell.username = "operator";
|
||||||
implementation = requests: {
|
implementation = requests: {
|
||||||
input = requests;
|
input = requests;
|
||||||
output =
|
output.nixops4 =
|
||||||
{ providers, ... }:
|
{ providers, ... }:
|
||||||
{
|
{
|
||||||
providers = {
|
providers = {
|
||||||
|
|
@ -145,7 +144,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
example-deployment = mkOption {
|
example-deployment = mkOption {
|
||||||
type = types.submodule nixops4Deployment;
|
type = options.deployments.nestedType;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = config.environments.single-nixos-vm.deployment config.example-configuration;
|
default = config.environments.single-nixos-vm.deployment config.example-configuration;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ let
|
||||||
functionTo
|
functionTo
|
||||||
;
|
;
|
||||||
|
|
||||||
functionType = import ./function.nix;
|
functionType = submodule ./function.nix;
|
||||||
application-resources = submodule {
|
application-resources = submodule {
|
||||||
options.resources = mkOption {
|
options.resources = mkOption {
|
||||||
# TODO: maybe transpose, and group the resources by type instead
|
# TODO: maybe transpose, and group the resources by type instead
|
||||||
|
|
@ -39,6 +39,12 @@ let
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
deployment = attrTag {
|
||||||
|
nixops4 = mkOption {
|
||||||
|
description = "A NixOps4 NixOS deployment. For an example, see https://github.com/nixops4/nixops4-nixos/blob/main/example/deployment.nix.";
|
||||||
|
type = nixops4Deployment;
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
|
|
@ -110,7 +116,7 @@ in
|
||||||
# TODO(@fricklerhandwerk): this needs a better name, it's just the type
|
# TODO(@fricklerhandwerk): this needs a better name, it's just the type
|
||||||
config-mapping = mkOption {
|
config-mapping = mkOption {
|
||||||
description = "Function type for the mapping from application configuration to required resources";
|
description = "Function type for the mapping from application configuration to required resources";
|
||||||
type = submodule functionType;
|
type = functionType;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = {
|
default = {
|
||||||
input-type = submodule application.config.module;
|
input-type = submodule application.config.module;
|
||||||
|
|
@ -145,12 +151,12 @@ in
|
||||||
type = environment.config.resource-mapping.function-type;
|
type = environment.config.resource-mapping.function-type;
|
||||||
};
|
};
|
||||||
resource-mapping = mkOption {
|
resource-mapping = mkOption {
|
||||||
description = "Function type for the mapping from resources to a (NixOps4) deployment";
|
description = "Function type for the mapping from resources to a deployment";
|
||||||
type = submodule functionType;
|
type = functionType;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = {
|
default = {
|
||||||
input-type = application-resources;
|
input-type = application-resources;
|
||||||
output-type = nixops4Deployment;
|
output-type = deployment;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# TODO(@fricklerhandwerk): maybe this should be a separate thing such as `fediversity-setup`,
|
# TODO(@fricklerhandwerk): maybe this should be a separate thing such as `fediversity-setup`,
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,14 @@
|
||||||
_class = "flake";
|
_class = "flake";
|
||||||
|
|
||||||
perSystem =
|
perSystem =
|
||||||
{ pkgs, ... }:
|
{ pkgs, system, ... }:
|
||||||
{
|
{
|
||||||
checks = {
|
checks = {
|
||||||
|
proxmox-basic = import ./check/proxmox {
|
||||||
|
inherit (pkgs.testers) runNixOSTest;
|
||||||
|
inherit sources system;
|
||||||
|
};
|
||||||
|
|
||||||
deployment-basic = import ./check/basic {
|
deployment-basic = import ./check/basic {
|
||||||
inherit (pkgs.testers) runNixOSTest;
|
inherit (pkgs.testers) runNixOSTest;
|
||||||
inherit inputs sources;
|
inherit inputs sources;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,13 @@
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
inputs:
|
inputs:
|
||||||
import ./mkFlake.nix inputs (
|
{
|
||||||
|
nixConfig = {
|
||||||
|
extra-trusted-substituters = "https://cache.saumon.network/proxmox-nixos";
|
||||||
|
extra-trusted-public-keys = "proxmox-nixos:D9RYSWpQQC/msZUWphOY2I5RLH5Dd6yQcaHIuug7dWM=";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// import ./mkFlake.nix inputs (
|
||||||
{ inputs, sources, ... }:
|
{ inputs, sources, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
|
|
||||||
4
nixmoxer.conf
Normal file
4
nixmoxer.conf
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
host=192.168.51.81
|
||||||
|
verify_ssl=0
|
||||||
|
user=kiara@ProcoliX
|
||||||
|
password=
|
||||||
|
|
@ -25,6 +25,22 @@
|
||||||
"url": null,
|
"url": null,
|
||||||
"hash": "1w2gsy6qwxa5abkv8clb435237iifndcxq0s79wihqw11a5yb938"
|
"hash": "1w2gsy6qwxa5abkv8clb435237iifndcxq0s79wihqw11a5yb938"
|
||||||
},
|
},
|
||||||
|
"crane": {
|
||||||
|
"type": "GitRelease",
|
||||||
|
"repository": {
|
||||||
|
"type": "GitHub",
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane"
|
||||||
|
},
|
||||||
|
"pre_releases": false,
|
||||||
|
"version_upper_bound": null,
|
||||||
|
"release_prefix": null,
|
||||||
|
"submodules": false,
|
||||||
|
"version": "v0.20.3",
|
||||||
|
"revision": "8468a0c46f81d806fd643ffe389fa80328b21cf4",
|
||||||
|
"url": "https://api.github.com/repos/ipetkov/crane/tarball/v0.20.3",
|
||||||
|
"hash": "0zw4275c3a6572w6vjmn850yddw6n3qagwfcq6ns247cx72fdfx0"
|
||||||
|
},
|
||||||
"disko": {
|
"disko": {
|
||||||
"type": "GitRelease",
|
"type": "GitRelease",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
@ -150,6 +166,32 @@
|
||||||
"revision": "f33a4d26226c05d501b9d4d3e5e60a3a59991921",
|
"revision": "f33a4d26226c05d501b9d4d3e5e60a3a59991921",
|
||||||
"url": "https://github.com/nixos/nixpkgs/archive/f33a4d26226c05d501b9d4d3e5e60a3a59991921.tar.gz",
|
"url": "https://github.com/nixos/nixpkgs/archive/f33a4d26226c05d501b9d4d3e5e60a3a59991921.tar.gz",
|
||||||
"hash": "1b6dm1sn0bdpcsmxna0zzspjaixa2dald08005fry5jrbjvwafdj"
|
"hash": "1b6dm1sn0bdpcsmxna0zzspjaixa2dald08005fry5jrbjvwafdj"
|
||||||
|
},
|
||||||
|
"nixpkgs-stable": {
|
||||||
|
"type": "Git",
|
||||||
|
"repository": {
|
||||||
|
"type": "GitHub",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs"
|
||||||
|
},
|
||||||
|
"branch": "nixos-25.05",
|
||||||
|
"submodules": false,
|
||||||
|
"revision": "a1ae8ef72f64a845ecce5c6dcf65d546bf7deeb4",
|
||||||
|
"url": "https://github.com/nixos/nixpkgs/archive/a1ae8ef72f64a845ecce5c6dcf65d546bf7deeb4.tar.gz",
|
||||||
|
"hash": "0d7lp30wyy5647gpm8rnihvdcpmgmfr9c5yg4fhl31lsg8mlbg16"
|
||||||
|
},
|
||||||
|
"proxmox-nixos": {
|
||||||
|
"type": "Git",
|
||||||
|
"repository": {
|
||||||
|
"type": "GitHub",
|
||||||
|
"owner": "SaumonNet",
|
||||||
|
"repo": "proxmox-nixos"
|
||||||
|
},
|
||||||
|
"branch": "main",
|
||||||
|
"submodules": false,
|
||||||
|
"revision": "48f39fbe2e8f90f9ac160dd4b6929f3ac06d8223",
|
||||||
|
"url": "https://github.com/SaumonNet/proxmox-nixos/archive/48f39fbe2e8f90f9ac160dd4b6929f3ac06d8223.tar.gz",
|
||||||
|
"hash": "0606qcs8x1jwckd1ivf52rqdmi3lkn66iiqh6ghd4kqx0g2bw3nv"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"version": 5
|
"version": 5
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue