mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 20:09:07 +01:00
scripts: Use trap to clean up temp directory
This commit is contained in:
parent
2c76d23692
commit
ec0d5b839e
2 changed files with 8 additions and 4 deletions
|
|
@ -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"
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue