restart podman when refresh

This commit is contained in:
Philip Peterson 2026-05-30 02:51:31 -08:00
parent 1334de7ff6
commit 33d2ae427a

View file

@ -18,6 +18,8 @@
nixPkgs = specialArgs.nixPkgs; nixPkgs = specialArgs.nixPkgs;
ourRustVersion = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.complete); ourRustVersion = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.complete);
vncContext = builtins.path { path = ./vnc-desktop; name = "vnc-desktop-context"; };
ourRustPlatform = nixPkgs.makeRustPlatform { ourRustPlatform = nixPkgs.makeRustPlatform {
rustc = ourRustVersion; rustc = ourRustVersion;
cargo = ourRustVersion; cargo = ourRustVersion;
@ -115,8 +117,8 @@ in {
systemd.services.arion-riverside.environment.DOCKER_HOST = "unix:///run/podman/podman.sock"; 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. # 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 # vncContext is a Nix store path that changes whenever any file under vnc-desktop/ changes,
# start.sh change, triggering a rebuild on the next nixos-rebuild switch. # which causes build-vnc-image to re-run and podman-vnc-desktop to restart on nixos-rebuild.
systemd.services.build-vnc-image = { systemd.services.build-vnc-image = {
description = "Build VNC desktop container image from Dockerfile"; description = "Build VNC desktop container image from Dockerfile";
wantedBy = [ "podman-vnc-desktop.service" ]; wantedBy = [ "podman-vnc-desktop.service" ];
@ -126,9 +128,7 @@ in {
RemainAfterExit = true; RemainAfterExit = true;
ExecStart = pkgs.writeShellScript "build-vnc-image" '' ExecStart = pkgs.writeShellScript "build-vnc-image" ''
STAMP=/var/lib/build-vnc-image/context-hash STAMP=/var/lib/build-vnc-image/context-hash
EXPECTED="${builtins.hashString "sha256" EXPECTED="${vncContext}"
(builtins.readFile ./vnc-desktop/Dockerfile +
builtins.readFile ./vnc-desktop/start.sh)}"
if [ -f "$STAMP" ] && [ "$(cat "$STAMP")" = "$EXPECTED" ]; then if [ -f "$STAMP" ] && [ "$(cat "$STAMP")" = "$EXPECTED" ]; then
echo "VNC image is up to date, skipping build" echo "VNC image is up to date, skipping build"
exit 0 exit 0
@ -136,13 +136,15 @@ in {
echo "Building VNC desktop image..." echo "Building VNC desktop image..."
${pkgs.podman}/bin/podman build \ ${pkgs.podman}/bin/podman build \
-t forge.quinefoundation.com/ironmagma/vnc-desktop:latest \ -t forge.quinefoundation.com/ironmagma/vnc-desktop:latest \
${./vnc-desktop} ${vncContext}
mkdir -p "$(dirname "$STAMP")" mkdir -p "$(dirname "$STAMP")"
echo "$EXPECTED" > "$STAMP" echo "$EXPECTED" > "$STAMP"
''; '';
}; };
}; };
systemd.services.podman-vnc-desktop.restartTriggers = [ "${vncContext}" ];
services.gitea-actions-runner.instances."ubuntu" = { services.gitea-actions-runner.instances."ubuntu" = {
enable = true; enable = true;
name = "ubuntu"; name = "ubuntu";