diff --git a/starter/configuration.nix b/starter/configuration.nix index f64e2f5..9aec3db 100644 --- a/starter/configuration.nix +++ b/starter/configuration.nix @@ -173,9 +173,24 @@ in { }; }; - system.activationScripts.mkVPN = '' - ${pkgs.docker}/bin/docker network create web - ''; + systemd.services.docker-network-web = { + description = "Create Docker Network Web"; + requires = ["docker.service"]; + after = ["docker.service"]; + wantedBy = ["multi-user.target"]; + + # Run on startup if network doesn't exist + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + + script = '' + if ! /run/current-system/sw/bin/docker network ls | grep -q 'web'; then + /run/current-system/sw/bin/docker network create web + fi + ''; + }; # System state version (do not change) system.stateVersion = "24.11";