containers/citrine: refactor networking and use proper nameservers

This commit is contained in:
Cilly Leang 2026-03-16 16:24:12 +11:00
parent ffcd5c93d2
commit a7afbda109
Signed by: cilly
GPG key ID: 6500251E087653C9

View file

@ -5,19 +5,25 @@
}; };
outputs = { nixpkgs, catppuccin, ... }: outputs = { nixpkgs, catppuccin, ... }:
let let
name = "citrine";
subnetId = "3";
subnet = x: "fd0d:1::${subnetId}:${x}";
host = subnet 1;
client = subnet 2;
modules = [ modules = [
./configuration.nix ./configuration.nix
catppuccin.nixosModules.catppuccin catppuccin.nixosModules.catppuccin
{
networking.useHostResolvConf = false;
networking.nameservers = [ host ];
}
]; ];
in { in {
nixosConfigurations.container = nixpkgs.lib.nixosSystem { nixosConfigurations.container = nixpkgs.lib.nixosSystem {
inherit modules; inherit modules;
}; };
nixosModule = { ... }: nixosModule = { ... }: {
let
name = "citrine";
subnet = "3";
in {
networking.nat = { networking.nat = {
enable = true; enable = true;
enableIPv6 = true; enableIPv6 = true;
@ -27,15 +33,15 @@
services.nginx.virtualHosts."garden.lava.moe" = { services.nginx.virtualHosts."garden.lava.moe" = {
useACMEHost = "lava.moe"; useACMEHost = "lava.moe";
forceSSL = true; forceSSL = true;
locations."/".proxyPass = "http://[fd0d:1::${subnet}:2]:3000"; locations."/".proxyPass = "http://[${client}]:3000";
}; };
systemd.tmpfiles.rules = [ "d /persist/containers/${name} 755 root users" ]; systemd.tmpfiles.rules = [ "d /persist/containers/${name} 755 root users" ];
containers.${name} = { containers.${name} = {
autoStart = true; autoStart = true;
privateNetwork = true; privateNetwork = true;
hostAddress6 = "fd0d:1::${subnet}:1"; hostAddress6 = host;
localAddress6 = "fd0d:1::${subnet}:2"; localAddress6 = client;
# privateUsers = "pick"; # privateUsers = "pick";
nixpkgs = nixpkgs; nixpkgs = nixpkgs;
ephemeral = true; ephemeral = true;