From 0f7d6a3c7cce273e002354bc71befa3ba17df3c3 Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 17 Jun 2022 23:23:31 +0200 Subject: [PATCH] flake.nix: add `nix store diff-closures` to microvm-update-* --- flake.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index b434767c..ed64ef9b 100644 --- a/flake.nix +++ b/flake.nix @@ -253,10 +253,17 @@ cd /var/lib/microvms/${name} chown root:kvm . chmod 0775 . + + rm -f old + [ -e current ] && mv current old + nix build -L \ -o current \ ${self}#nixosConfigurations.${name}.config.microvm.declaredRunner echo '${selfRef}' > flake + + [ -e old ] && nix store diff-closures ./old ./current + systemctl restart microvm@${name}.service END ''; @@ -270,9 +277,15 @@ cd /var/lib/microvms/${name} chown root:kvm . chmod 0775 . - rm -f current + + rm -f old + [ -e current ] && mv current old + ln -s ${hostConfig.microvm.declaredRunner} current echo '${selfRef}' > flake + + [ -e old ] && nix store diff-closures ./old ./current + systemctl restart microvm@${name}.service END '';