aboutsummaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2021-11-13 01:34:59 -0500
committertdro <tdro@users.noreply.github.com>2021-11-13 01:34:59 -0500
commit383b82048621978e4ab65118790907e6fa599e55 (patch)
treec4795f7bacf336e3df56549926d99bf96037e0e8 /.local
parent9785f89096b7b9c64759bad36acd3d50b2159f23 (diff)
downloaddotfiles-383b82048621978e4ab65118790907e6fa599e55.tar.gz
dotfiles-383b82048621978e4ab65118790907e6fa599e55.tar.bz2
dotfiles-383b82048621978e4ab65118790907e6fa599e55.zip
.local/bin/nixos-test: Check for file existence
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/nixos-test12
1 files changed, 7 insertions, 5 deletions
diff --git a/.local/bin/nixos-test b/.local/bin/nixos-test
index aeb2549..3912461 100755
--- a/.local/bin/nixos-test
+++ b/.local/bin/nixos-test
@@ -1,13 +1,15 @@
#!/bin/sh -eu
{ [ "${1:-}" = "-h" ] ||
- [ "${1:-}" = "--help" ] ||
- [ "$#" = 0 ]; } &&
- printf "nixos-test [FILE]...\n" &&
- exit;
+ [ "${1:-}" = "--help" ] ||
+ [ "$#" = 0 ]; } &&
+ printf "nixos-test [FILE]...\n" &&
+ exit
+
+[ -f "$1" ] || { printf "Error: File '%s' not found\n" "$1" && exit; }
awk '!s {s=sub("^{$","{ boot.isContainer = true;")}{ print $0 }' "$1" | sponge "$1"
-NIXOS_CONFIG=$(realpath "$1") nixos-rebuild --fast dry-build || true;
+NIXOS_CONFIG=$(realpath "$1") nixos-rebuild --fast dry-build || true
awk '!s {s=sub("{ boot.isContainer = true;","{")}{ print $0 }' "$1" | sponge "$1"