Merge pull request #288 from ryan4yin/feat/aquamarine-to-youko

feat: run aquamarine's services natively on kubevirt-youko
This commit is contained in:
ryan4yin | 二花 authored and GitHub committed 2026-09-21 15:50:25 +08:00
commit bbc4bf9449
85 files changed
+48 -170

No files matched your search

-6
View File
@@ -230,15 +230,9 @@ youko mode="switch":
upload-idols verbosity="normal":
#!/usr/bin/env nu
use {{utils_nu}} *;
upload-vm aquamarine 80Gi {{verbosity}}
upload-vm ruby 100Gi {{verbosity}}
upload-vm kana 100Gi {{verbosity}}
[linux]
[group('homelab')]
aqua mode="switch":
colmena apply {{mode}} --on '@aqua' --verbose --show-trace
[linux]
[group('homelab')]
ruby mode="switch":
Generated
+3 -3
View File
@@ -503,10 +503,10 @@
"mysecrets": {
"flake": false,
"locked": {
"lastModified": 1789875389,
"narHash": "sha256-aHBxNh96dBsOzKqNcLdo4H4XzE0IAD1KVFXMNdV3W+s=",
"lastModified": 1789975872,
"narHash": "sha256-DQrX1au7BWEzXJqR2FBiSYdF0DWd5NMh12y6ovtn41o=",
"ref": "refs/heads/main",
"rev": "8cd11a98a258410e3af03a2bf3bfeff2201fa5f8",
"rev": "4def15deec5c0538df16ad2d49028298ee81d7ab",
"shallow": true,
"type": "git",
"url": "ssh://git@github.com/ryan4yin/nix-secrets.git"
-3
View File
@@ -1,3 +0,0 @@
{
imports = [ ../../linux/core.nix ];
}
-88
View File
@@ -1,88 +0,0 @@
{
lib,
mylib,
myvars,
pkgs,
disko,
...
}:
#############################################################
#
# Aquamarine - A NixOS VM running on Proxmox/KubeVirt
#
#############################################################
let
hostName = "aquamarine"; # Define your hostname.
inherit (myvars.networking) proxyGateway proxyGateway6 nameservers;
inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4;
ipv4WithMask = "${ipv4}/24";
in
{
imports = (mylib.scanPaths ./.) ++ [
disko.nixosModules.default
];
# supported file systems, so we can mount any removable disks with these filesystems
boot.supportedFilesystems = [
"ext4"
"btrfs"
"xfs"
#"zfs"
"ntfs"
"fat"
"vfat"
"exfat"
];
# Maximum total amount of memory that can be stored in the zram swap devices (as a percentage of your total memory).
# Defaults to 1/2 of your total RAM. Run zramctl to check how good memory is compressed.
# This doesn’t define how much memory will be used by the zram swap devices.
zramSwap.memoryPercent = lib.mkForce 100;
boot.kernelModules = [ "kvm-amd" ];
boot.extraModprobeConfig = "options kvm_amd nested=1"; # for amd cpu
networking = {
inherit hostName;
# we use networkd instead
networkmanager.enable = false;
useDHCP = false;
};
networking.useNetworkd = true;
systemd.network.enable = true;
systemd.network.networks."10-${iface}" = {
matchConfig.Name = [ iface ];
networkConfig = {
Address = [ ipv4WithMask ];
# DNS = nameservers;
DNS = [ proxyGateway ];
DHCP = "ipv6"; # enable DHCPv6 only, so we can get a GUA.
IPv6AcceptRA = true; # for Stateless IPv6 Autoconfiguraton (SLAAC)
LinkLocalAddressing = "ipv6";
};
routes = [
{
Destination = "0.0.0.0/0";
Gateway = proxyGateway;
}
{
Destination = "::/0";
Gateway = proxyGateway6;
GatewayOnLink = true; # it's a gateway on local link.
}
];
linkConfig.RequiredForOnline = "routable";
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment?
}
-8
View File
@@ -1,8 +0,0 @@
{
# systemd-journal - reduce disk usage
# https://www.freedesktop.org/software/systemd/man/latest/journald.conf.html
services.journald.settings.Journal = {
SystemMaxUse = "2G";
RuntimeMaxUse = "256M";
};
}
@@ -0,0 +1,21 @@
{ ... }:
{
# The homelab service modules (caddy, gitea, grafana, monitoring, oci
# containers, postgresql, restic, sftpgo, transmission, and the HDD disko
# config) live in ./homelab-services/ and are auto-imported by this host's
# scanPaths. Its HDD disko config only defines the two data disks (no root
# disk), so it is imported as-is -- disko's NixOS module only generates the
# fileSystems/mounts, it never reformats.
#
# keep aquamarine's IP on this host's bridge so its services and DNS keep
# resolving after the migration (the NixOS list option merges with the .183)
systemd.network.networks."10-br0".networkConfig.Address = [ "192.168.5.101/24" ];
# the same secret groups the aqua VM enabled
modules.secrets.server = {
application.enable = true;
operation.enable = true;
webserver.enable = true;
storage.enable = true;
};
}
@@ -1,4 +1,5 @@
{
mylib,
pkgs,
config,
wallpapers,
@@ -7,7 +8,9 @@
let
hostCommonConfig = ''
encode zstd gzip
tls ${../../certs/ecc-server.crt} ${config.age.secrets."caddy-ecc-server.key".path} {
tls ${mylib.relativeToRoot "certs/ecc-server.crt"} ${
config.age.secrets."caddy-ecc-server.key".path
} {
protocols tls1.3 tls1.3
curves x25519 secp384r1 secp521r1
}
@@ -0,0 +1,6 @@
{ mylib, ... }:
{
# The homelab service modules, migrated here from the retired
# `hosts/idols-aquamarine` guest, now running directly on this host.
imports = mylib.scanPaths ./.;
}
@@ -1,7 +1,7 @@
# Auto disk partitioning (from repo root: nix-config):
# nix run github:nix-community/disko -- --mode destroy,format,mount hosts/idols-aquamarine/disko-fs.nix
# nix run github:nix-community/disko -- --mode destroy,format,mount hosts/k8s/kubevirt-youko/homelab-services/disko-fs.nix
# Mount only (after first format):
# nix run github:nix-community/disko -- --mode mount hosts/idols-aquamarine/disko-fs.nix
# nix run github:nix-community/disko -- --mode mount hosts/k8s/kubevirt-youko/homelab-services/disko-fs.nix
let
cryptKeyFile = "/etc/agenix/hdd-luks-crypt-key";
unlockDisk = "data-encrypted";
@@ -1,4 +1,4 @@
{ config, ... }:
{ config, mylib, ... }:
{
# Declaratively provision Grafana's data sources, dashboards, and alerting rules.
@@ -114,7 +114,7 @@
postgresVersion = 1500; # 15.xx
# tls
tlsConfigurationMethod = "file-path";
sslRootCertFile = ../../../certs/ecc-ca.crt;
sslRootCertFile = mylib.relativeToRoot "certs/ecc-ca.crt";
};
editable = false;
}
@@ -22,7 +22,7 @@ in
# check its logs via `journalctl -u podman-homepage`
uptime-kuma = {
hostname = "uptime-kuma";
image = "louislam/uptime-kuma:1";
image = "docker.io/louislam/uptime-kuma:1";
ports = [ "127.0.0.1:53350:3001" ];
# https://github.com/louislam/uptime-kuma/wiki/Environment-Variables
environment = {
@@ -1,5 +1,6 @@
{
config,
mylib,
pkgs,
lib,
myvars,
@@ -69,7 +70,7 @@ in
# ssl
ssl = true;
ssl_cert_file = "${../../certs/ecc-server.crt}";
ssl_cert_file = "${mylib.relativeToRoot "certs/ecc-server.crt"}";
ssl_key_file = config.age.secrets."postgres-ecc-server.key".path;
ssl_min_protocol_version = "TLSv1.3";
ssl_ecdh_curve = "secp384r1";
@@ -136,4 +136,9 @@ in
seed-queue-size = 10;
};
};
# The /data mounts are `nofail`, so nothing orders transmission after them;
# without this the unit can start before /data/fileshare/public is mounted and
# fail its mount-namespace setup (seen on the host, where the tasks race).
systemd.services.transmission.unitConfig.RequiresMountsFor = "/data/fileshare/public";
}
@@ -1,51 +0,0 @@
{
# NOTE: the args not used in this file CAN NOT be removed!
# because haumea pass argument lazily,
# and these arguments are used in the functions like `mylib.nixosSystem`, `mylib.colmenaSystem`, etc.
inputs,
lib,
mylib,
myvars,
system,
genSpecialArgs,
...
}@args:
let
# 星野 愛久愛海, Hoshino Akuamarin
name = "aquamarine";
tags = [
"aqua"
"homelab-network"
];
ssh-user = "root";
modules = {
nixos-modules =
(map mylib.relativeToRoot [
# common
"secrets/nixos.nix"
"modules/nixos/server/server.nix"
"modules/nixos/server/kubevirt-hardware-configuration.nix"
# host specific
"hosts/idols-${name}"
])
++ [
{ modules.secrets.server.application.enable = true; }
{ modules.secrets.server.operation.enable = true; }
{ modules.secrets.server.webserver.enable = true; }
{ modules.secrets.server.storage.enable = true; }
];
home-modules = map mylib.relativeToRoot [
"home/hosts/linux/idols-${name}.nix"
];
};
systemArgs = modules // args;
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.system.build.images.kubevirt;
}
@@ -5,7 +5,6 @@ in
lib.genAttrs
[
"ai-niri"
"aquamarine"
"ruby"
]
(_: {
@@ -7,7 +7,6 @@ let
username = myvars.username;
hosts = [
"ai-niri"
"aquamarine"
"ruby"
];
in
@@ -3,7 +3,7 @@
outputs,
}:
let
aqua = outputs.nixosConfigurations.aquamarine.config;
aqua = outputs.nixosConfigurations.kubevirt-youko.config;
in
{
v2rayExporter = aqua.services.prometheus.exporters.v2ray.listenAddress;
@@ -5,7 +5,7 @@
}:
let
shushou = outputs.nixosConfigurations.kubevirt-shushou.config;
aquamarine = outputs.nixosConfigurations.aquamarine.config;
aquamarine = outputs.nixosConfigurations.kubevirt-youko.config;
ups = shushou.power.ups.ups.homelab or { };
exporter = shushou.services.prometheus.exporters.nut;
exporterService =