From 2760c8b32f9dc6c8a8e315a5604dd530d980cca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Numbus?= Date: Fri, 9 Jan 2026 10:54:31 +0100 Subject: [PATCH] Updated activation script. Fixed typo. --- deploy.sh | 8 +++---- templates/nix-config/misc/activation.nix | 28 +++++++++++++++++++----- templates/nix-config/podman/traefik.nix | 2 +- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/deploy.sh b/deploy.sh index 66330f5..476ac9b 100644 --- a/deploy.sh +++ b/deploy.sh @@ -386,18 +386,18 @@ services_generation() { if [[ "${service}" != "virtualization" ]]; then if [[ "${service}" == "nextcloud" ]]; then cp templates/nix-config/podman/${service}.nix final-nix-config/etc/nixos/podman/${service}.nix - PODMAN_NETWORKS+=" \${pkgs.podman}/bin/podman network create --driver=bridge --subnet=172.16.${j}0.0/24 --ip-range=172.16.${j}0.0/24 --gateway=172.16.${j}0.254 nextcloud-aio"$'\n' + PODMAN_NETWORKS+=". \${pkgs.podman}/bin/podman network create --driver=bridge --subnet=172.16.${j}0.0/24 --ip-range=172.16.${j}0.0/24 --gateway=172.16.${j}0.254 nextcloud-aio"$'\n' TRAEFIK_NETWORKS+=" nextcloud-aio:"$'\n' TRAEFIK_NETWORKS+=" ipv4_address: 172.16.${j}0.253"$'\n' TRAEFIK_REF_NETWORKS+=" nextcloud-aio:"$'\n' TRAEFIK_REF_NETWORKS+=" external: true"$'\n' - elif [[ "${service}" == "nextcloud" ]]; then + elif [[ "${service}" == "frigate" ]]; then : else j=$((j + 1)) cp templates/nix-config/podman/${service}.nix final-nix-config/etc/nixos/podman/${service}.nix - PODMAN_NETWORKS+=" \${pkgs.podman}/bin/podman network create --driver=bridge --subnet=172.16.${j}.0/24 --ip-range=172.16.${j}.0/24 --gateway=172.16.${j}.254 ${service}_backend"$'\n' - PODMAN_NETWORKS+=" \${pkgs.podman}/bin/podman network create --driver=bridge --subnet=172.16.${j}0.0/24 --ip-range=172.16.${j}0.0/24 --gateway=172.16.${j}0.254 ${service}_frontend"$'\n' + PODMAN_NETWORKS+=" \${pkgs.podman}/bin/podman network create --driver=bridge --subnet=172.16.${j}.0/24 --ip-range=172.16.${j}.0/24 --gateway=172.16.${j}.254 ${service}_backend"$'\n' + PODMAN_NETWORKS+=" \${pkgs.podman}/bin/podman network create --driver=bridge --subnet=172.16.${j}0.0/24 --ip-range=172.16.${j}0.0/24 --gateway=172.16.${j}0.254 ${service}_frontend"$'\n' TRAEFIK_NETWORKS+=" ${service}_frontend:"$'\n' TRAEFIK_NETWORKS+=" ipv4_address: 172.16.${j}0.253"$'\n' TRAEFIK_REF_NETWORKS+=" ${service}_frontend:"$'\n' diff --git a/templates/nix-config/misc/activation.nix b/templates/nix-config/misc/activation.nix index 621bc68..18c4994 100644 --- a/templates/nix-config/misc/activation.nix +++ b/templates/nix-config/misc/activation.nix @@ -1,12 +1,28 @@ { config, pkgs, ... }: { - system.activationScripts.script.text = '' - #!/bin/bash - ${pkgs.coreutils}/bin/mkdir -p /mnt/config/ /mnt/data/ - ${pkgs.coreutils}/bin/chown -R numbus-admin:users /mnt/config/ - ${pkgs.coreutils}/bin/chown -R numbus-admin:users /mnt/data/ + systemd.services.numbus-activation = { + description = "Numbus Server Activation"; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" "local-fs.target" ]; + serviceConfig = { + User = "numbus-admin"; + Environment = [ "XDG_RUNTIME_DIR=/run/user/1000" ]; + Type = "oneshot"; + RemainAfterExit = true; + }; + script = '' + if [[ -e /etc/numbus-server/activated.true ]]; then + exit 0 + fi + + ${pkgs.coreutils}/bin/mkdir -p /mnt/config/ /mnt/data/ + ${pkgs.coreutils}/bin/chown -R numbus-admin:users /mnt/config/ + ${pkgs.coreutils}/bin/chown -R numbus-admin:users /mnt/data/ PODMAN_NETWORKS - ''; + + ${pkgs.coreutils}/bin/touch /etc/numbus-server/activated.true + ''; + }; } \ No newline at end of file diff --git a/templates/nix-config/podman/traefik.nix b/templates/nix-config/podman/traefik.nix index 44c6c31..20173cd 100644 --- a/templates/nix-config/podman/traefik.nix +++ b/templates/nix-config/podman/traefik.nix @@ -44,7 +44,7 @@ TRAEFIK_REF_NETWORKS systemd.services.traefik = { description = "Podman container : ${container_name}"; - after = [ "network.target" ]; + after = [ "network.target" "numbus-activation.service" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = {