Add a variable for the network name

This commit is contained in:
Andreas Zweili 2022-11-05 16:09:17 +01:00
parent 649e1a9f62
commit ff704efb56
1 changed files with 4 additions and 3 deletions

View File

@ -10,6 +10,7 @@ let
SMTP_SECURE = "ssl"; SMTP_SECURE = "ssl";
SMTP_PORT = "465"; SMTP_PORT = "465";
}; };
networkName = "nextcloud";
in in
{ {
age.secrets.nextcloudEnv.file = "${custom.inputs.self}/scrts/nextcloud_env.age"; age.secrets.nextcloudEnv.file = "${custom.inputs.self}/scrts/nextcloud_env.age";
@ -31,7 +32,7 @@ in
extraOptions = [ extraOptions = [
''--mount=type=volume,source=nextcloud_data,target=/var/www/html,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/server_data/nextcloud/data,"volume-opt=o=addr=10.7.89.108,rw,nfsvers=4.0,nolock,hard,noatime"'' ''--mount=type=volume,source=nextcloud_data,target=/var/www/html,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/server_data/nextcloud/data,"volume-opt=o=addr=10.7.89.108,rw,nfsvers=4.0,nolock,hard,noatime"''
"--add-host=host.docker.internal:host-gateway" "--add-host=host.docker.internal:host-gateway"
"--net=nextcloud" "--net=${networkName}"
]; ];
}; };
containers."cron" = { containers."cron" = {
@ -51,12 +52,12 @@ in
image = "redis:alpine"; image = "redis:alpine";
autoStart = true; autoStart = true;
extraOptions = [ extraOptions = [
"--net=nextcloud" "--net=${networkName}"
]; ];
}; };
}; };
system.activationScripts.makeDokerNetwork = '' system.activationScripts.makeDokerNetwork = ''
${pkgs.docker}/bin/docker network ls | ${pkgs.gnugrep}/bin/grep nextcloud || {pkgs.docker}/bin/docker network create nextcloud ${pkgs.docker}/bin/docker network ls | ${pkgs.gnugrep}/bin/grep ${networkName} || {pkgs.docker}/bin/docker network create ${networkName}
''; '';
} }