From 5a24bf690f85e9d306bc78ec1c7a3b5cdf68ac21 Mon Sep 17 00:00:00 2001 From: Cilly Leang Date: Sun, 15 Mar 2026 19:32:34 +1100 Subject: [PATCH] containers/amethyst: refactor --- containers/amethyst/flake.nix | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/containers/amethyst/flake.nix b/containers/amethyst/flake.nix index e025a5b..a8bbeee 100644 --- a/containers/amethyst/flake.nix +++ b/containers/amethyst/flake.nix @@ -6,28 +6,32 @@ nixosConfigurations.container = nixpkgs.lib.nixosSystem { modules = [ ./configuration.nix ]; }; - nixosModule = { ... }: { + nixosModule = { ... }: + let + name = "amethyst"; + subnet = "1"; + in { networking.nat = { enable = true; enableIPv6 = true; internalInterfaces = [ "ve-+" ]; }; - systemd.tmpfiles.rules = [ "d /persist/containers/amethyst 755 root users" ]; - containers.amethyst = { + systemd.tmpfiles.rules = [ "d /persist/containers/${name} 755 root users" ]; + containers.${name} = { autoStart = true; privateNetwork = true; - hostAddress = "10.30.1.1"; - localAddress = "10.30.1.2"; - hostAddress6 = "fd0d:1::1:1"; - localAddress6 = "fd0d:1::1:2"; + hostAddress = "10.30.${subnet}.1"; + localAddress = "10.30.${subnet}.2"; + hostAddress6 = "fd0d:1::${subnet}:1"; + localAddress6 = "fd0d:1::${subnet}:2"; # privateUsers = "pick"; nixpkgs = nixpkgs; ephemeral = true; config = { imports = [ ./configuration.nix ]; }; bindMounts."persist" = { - hostPath = "/persist/containers/amethyst"; + hostPath = "/persist/containers/${name}"; mountPoint = "/persist"; isReadOnly = false; };