From 33d2ae427a0af97d9f7102c2319d7933b0908b0f Mon Sep 17 00:00:00 2001 From: Philip Peterson Date: Sat, 30 May 2026 02:51:31 -0800 Subject: [PATCH] restart podman when refresh --- nixos/linux.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/nixos/linux.nix b/nixos/linux.nix index b052b51..ed1cef9 100644 --- a/nixos/linux.nix +++ b/nixos/linux.nix @@ -18,6 +18,8 @@ nixPkgs = specialArgs.nixPkgs; ourRustVersion = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.complete); + vncContext = builtins.path { path = ./vnc-desktop; name = "vnc-desktop-context"; }; + ourRustPlatform = nixPkgs.makeRustPlatform { rustc = ourRustVersion; cargo = ourRustVersion; @@ -115,8 +117,8 @@ in { systemd.services.arion-riverside.environment.DOCKER_HOST = "unix:///run/podman/podman.sock"; # Build the VNC desktop image locally from the Dockerfile — no registry push/pull needed. - # Nix copies the build context into the store; the hash changes when Dockerfile or - # start.sh change, triggering a rebuild on the next nixos-rebuild switch. + # vncContext is a Nix store path that changes whenever any file under vnc-desktop/ changes, + # which causes build-vnc-image to re-run and podman-vnc-desktop to restart on nixos-rebuild. systemd.services.build-vnc-image = { description = "Build VNC desktop container image from Dockerfile"; wantedBy = [ "podman-vnc-desktop.service" ]; @@ -126,9 +128,7 @@ in { RemainAfterExit = true; ExecStart = pkgs.writeShellScript "build-vnc-image" '' STAMP=/var/lib/build-vnc-image/context-hash - EXPECTED="${builtins.hashString "sha256" - (builtins.readFile ./vnc-desktop/Dockerfile + - builtins.readFile ./vnc-desktop/start.sh)}" + EXPECTED="${vncContext}" if [ -f "$STAMP" ] && [ "$(cat "$STAMP")" = "$EXPECTED" ]; then echo "VNC image is up to date, skipping build" exit 0 @@ -136,13 +136,15 @@ in { echo "Building VNC desktop image..." ${pkgs.podman}/bin/podman build \ -t forge.quinefoundation.com/ironmagma/vnc-desktop:latest \ - ${./vnc-desktop} + ${vncContext} mkdir -p "$(dirname "$STAMP")" echo "$EXPECTED" > "$STAMP" ''; }; }; + systemd.services.podman-vnc-desktop.restartTriggers = [ "${vncContext}" ]; + services.gitea-actions-runner.instances."ubuntu" = { enable = true; name = "ubuntu";