From ec0d5b839ed7cf9ca9cff24180821cfd636b5248 Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Thu, 5 Feb 2026 22:55:20 +0100 Subject: [PATCH] scripts: Use trap to clean up temp directory --- scripts/install-anywhere.nix | 5 ++--- scripts/nebula-regen-all-host-certs.nix | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/install-anywhere.nix b/scripts/install-anywhere.nix index ca0b4f2..17e5c0b 100644 --- a/scripts/install-anywhere.nix +++ b/scripts/install-anywhere.nix @@ -1,4 +1,4 @@ -{ pkgs , ...}: +{ pkgs, ... }: pkgs.writeShellApplication { name = "install-anywhere"; @@ -17,6 +17,7 @@ pkgs.writeShellApplication { host="$1" destination="$2" root="$(mktemp --directory)" + trap 'rm -rf "$root"' EXIT impermanence="$(nix eval ".#nixosConfigurations.$host.config.custom.persistence.enable")" if [ "$impermanence" = true ]; then @@ -51,7 +52,5 @@ pkgs.writeShellApplication { --extra-files "$root" \ --flake ".#$host" \ --target-host "$destination" - - rm -rf "$root" ''; } diff --git a/scripts/nebula-regen-all-host-certs.nix b/scripts/nebula-regen-all-host-certs.nix index db09d6c..469d25b 100644 --- a/scripts/nebula-regen-all-host-certs.nix +++ b/scripts/nebula-regen-all-host-certs.nix @@ -1,4 +1,9 @@ -{ self', pkgs, lib, ... }: +{ + self', + pkgs, + lib, + ... +}: pkgs.writeShellApplication { name = "nebula-regen-all-host-certs";