flakes/containers/citrine/flake.nix

69 lines
1.7 KiB
Nix
Raw Normal View History

2026-03-16 00:48:51 +11:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2026-03-16 02:32:09 +11:00
catppuccin.url = "github:catppuccin/nix";
2026-03-16 00:48:51 +11:00
};
2026-03-16 02:32:09 +11:00
outputs = { nixpkgs, catppuccin, ... }:
let
name = "citrine";
2026-03-17 17:01:15 +11:00
fqdn = "garden.lava.moe";
subnetId = "3";
2026-03-16 16:25:25 +11:00
subnet = x: "fd0d:1::${subnetId}:${toString x}";
host = subnet 1;
client = subnet 2;
subnet4 = x: "10.30.${subnetId}.${toString x}";
host4 = subnet4 1;
client4 = subnet4 2;
2026-03-16 02:32:09 +11:00
modules = [
./configuration.nix
catppuccin.nixosModules.catppuccin
{
networking.useHostResolvConf = false;
networking.nameservers = [ host ];
}
2026-03-16 02:32:09 +11:00
];
in {
2026-03-16 00:48:51 +11:00
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
2026-03-16 02:32:09 +11:00
inherit modules;
2026-03-16 00:48:51 +11:00
};
nixosModule = { ... }: {
2026-03-16 16:18:41 +11:00
networking.nat = {
enable = true;
enableIPv6 = true;
internalInterfaces = [ "ve-${name}" ];
};
2026-03-17 17:01:15 +11:00
services.nginx.virtualHosts."${fqdn}" = {
2026-03-16 00:48:51 +11:00
useACMEHost = "lava.moe";
forceSSL = true;
locations."/".proxyPass = "http://[${client}]:3000";
2026-03-16 00:48:51 +11:00
};
systemd.tmpfiles.rules = [ "d /persist/containers/${name} 755 root users" ];
containers.${name} = {
autoStart = true;
privateNetwork = true;
hostAddress = host4;
localAddress = client4;
hostAddress6 = host;
localAddress6 = client;
2026-03-16 00:48:51 +11:00
# privateUsers = "pick";
nixpkgs = nixpkgs;
ephemeral = true;
2026-03-16 02:32:09 +11:00
config = { imports = modules; };
2026-03-17 17:01:15 +11:00
specialArgs = { inherit fqdn; };
2026-03-16 00:48:51 +11:00
bindMounts."persist" = {
hostPath = "/persist/containers/${name}";
mountPoint = "/persist";
isReadOnly = false;
};
# flake = "path:" + ./.;
};
};
};
}