test-vm: Add WHIB backend

This commit is contained in:
Alexander Heldt
2024-11-09 10:41:13 +01:00
parent 51d32e66c4
commit b29029afc6
5 changed files with 135 additions and 8 deletions

24
flake.lock generated
View File

@@ -241,7 +241,8 @@
"nix-gc-env": "nix-gc-env",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"pppdotpm-site": "pppdotpm-site"
"pppdotpm-site": "pppdotpm-site",
"whib-backend": "whib-backend"
}
},
"systems": {
@@ -258,6 +259,27 @@
"repo": "default",
"type": "github"
}
},
"whib-backend": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1735899504,
"narHash": "sha256-Ap8GreoeEcey6LDAirjv7UmZJ5Dg1jfnFc924Q3WDOU=",
"ref": "master",
"rev": "ca43a546fccb16bdebd6b041129cc0de42fde331",
"revCount": 365,
"type": "git",
"url": "ssh://gitea@git.ppp.pm:1122/alex/whib.git"
},
"original": {
"ref": "master",
"type": "git",
"url": "ssh://gitea@git.ppp.pm:1122/alex/whib.git"
}
}
},
"root": "root",

View File

@@ -37,6 +37,11 @@
url = "git+ssh://gitea@git.ppp.pm:1122/alex/ppp.pm-site.git?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
};
whib-backend = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/whib.git?ref=master";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
@@ -77,13 +82,20 @@
];
};
test-vm = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs;
test-vm =
let
system = "x86_64-linux";
in
inputs.nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
};
modules = [
./hosts/test-vm/configuration.nix
inputs.whib-backend.nixosModules.${system}.default
];
};
modules = [ ./hosts/test-vm/configuration.nix ];
};
};
devShells =

View File

@@ -14,6 +14,8 @@
home.homeDirectory = "/home/alex";
home.packages = [
inputs.whib-backend.packages.${pkgs.system}.whib-import
pkgs.beekeeper-studio
pkgs.bitwarden-desktop
pkgs.gimp
pkgs.zip

View File

@@ -2,6 +2,7 @@
{
imports = [
./ppp.pm-site.nix
./whib-backend.nix
];
config = {
@@ -10,7 +11,8 @@
networking.hostName = "test-vm";
mod = {
pppdotpm-site.enable = true;
pppdotpm-site.enable = false;
whib-backend.enable = true;
};
users.users.a = {

View File

@@ -0,0 +1,89 @@
{
lib,
config,
...
}:
let
enabled = config.mod.whib-backend.enable;
in
{
options = {
mod.whib-backend = {
enable = lib.mkEnableOption "enable WHIB backend";
};
};
config = lib.mkIf enabled {
services.whib-backend = {
enable = true;
domain = "whib-backend.local";
backend = {
signingKey = "super-secret-key";
};
postgres = {
password = "postgrespassword";
backup = {
interval = "*-*-* *:*:00 UTC"; # Every minute, for testing
# Set these for test runs
gpgPassphraseFile = "";
backblazeBucket = "";
backblazeKeyID = "";
backblazeKey = "";
};
};
grafana = {
password = "granfanapassword";
};
};
virtualisation.vmVariant = {
virtualisation = {
sharedDirectories = {
my-shared = {
source = "/home/alex/whib-backup";
target = "/mnt/shared";
};
};
forwardPorts = [
{
# Service API
from = "host";
host.port = 8080;
guest.port = 8080;
}
{
# Service Metrics
from = "host";
host.port = 8181;
guest.port = 8181;
}
{
# Postgres
from = "host";
host.port = 5432;
guest.port = 5432;
}
{
# Grafana
from = "host";
host.port = 3000;
guest.port = 3000;
}
{
# Prometheus
from = "host";
host.port = 9090;
guest.port = 9090;
}
];
};
};
};
}