containers/amethyst: refactor
This commit is contained in:
parent
acc4d31f46
commit
5a24bf690f
1 changed files with 12 additions and 8 deletions
|
|
@ -6,28 +6,32 @@
|
||||||
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
|
||||||
modules = [ ./configuration.nix ];
|
modules = [ ./configuration.nix ];
|
||||||
};
|
};
|
||||||
nixosModule = { ... }: {
|
nixosModule = { ... }:
|
||||||
|
let
|
||||||
|
name = "amethyst";
|
||||||
|
subnet = "1";
|
||||||
|
in {
|
||||||
networking.nat = {
|
networking.nat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableIPv6 = true;
|
enableIPv6 = true;
|
||||||
internalInterfaces = [ "ve-+" ];
|
internalInterfaces = [ "ve-+" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [ "d /persist/containers/amethyst 755 root users" ];
|
systemd.tmpfiles.rules = [ "d /persist/containers/${name} 755 root users" ];
|
||||||
containers.amethyst = {
|
containers.${name} = {
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
privateNetwork = true;
|
privateNetwork = true;
|
||||||
hostAddress = "10.30.1.1";
|
hostAddress = "10.30.${subnet}.1";
|
||||||
localAddress = "10.30.1.2";
|
localAddress = "10.30.${subnet}.2";
|
||||||
hostAddress6 = "fd0d:1::1:1";
|
hostAddress6 = "fd0d:1::${subnet}:1";
|
||||||
localAddress6 = "fd0d:1::1:2";
|
localAddress6 = "fd0d:1::${subnet}:2";
|
||||||
# privateUsers = "pick";
|
# privateUsers = "pick";
|
||||||
nixpkgs = nixpkgs;
|
nixpkgs = nixpkgs;
|
||||||
ephemeral = true;
|
ephemeral = true;
|
||||||
config = { imports = [ ./configuration.nix ]; };
|
config = { imports = [ ./configuration.nix ]; };
|
||||||
|
|
||||||
bindMounts."persist" = {
|
bindMounts."persist" = {
|
||||||
hostPath = "/persist/containers/amethyst";
|
hostPath = "/persist/containers/${name}";
|
||||||
mountPoint = "/persist";
|
mountPoint = "/persist";
|
||||||
isReadOnly = false;
|
isReadOnly = false;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue