mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 23:29:08 +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 {
|
pkgs.writeShellApplication {
|
||||||
name = "install-anywhere";
|
name = "install-anywhere";
|
||||||
|
|
||||||
|
|
@ -17,6 +17,7 @@ pkgs.writeShellApplication {
|
||||||
host="$1"
|
host="$1"
|
||||||
destination="$2"
|
destination="$2"
|
||||||
root="$(mktemp --directory)"
|
root="$(mktemp --directory)"
|
||||||
|
trap 'rm -rf "$root"' EXIT
|
||||||
|
|
||||||
impermanence="$(nix eval ".#nixosConfigurations.$host.config.custom.persistence.enable")"
|
impermanence="$(nix eval ".#nixosConfigurations.$host.config.custom.persistence.enable")"
|
||||||
if [ "$impermanence" = true ]; then
|
if [ "$impermanence" = true ]; then
|
||||||
|
|
@ -51,7 +52,5 @@ pkgs.writeShellApplication {
|
||||||
--extra-files "$root" \
|
--extra-files "$root" \
|
||||||
--flake ".#$host" \
|
--flake ".#$host" \
|
||||||
--target-host "$destination"
|
--target-host "$destination"
|
||||||
|
|
||||||
rm -rf "$root"
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
{ self', pkgs, lib, ... }:
|
{
|
||||||
|
self',
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
pkgs.writeShellApplication {
|
pkgs.writeShellApplication {
|
||||||
name = "nebula-regen-all-host-certs";
|
name = "nebula-regen-all-host-certs";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue