aboutsummaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2021-11-14 21:25:50 -0500
committertdro <tdro@users.noreply.github.com>2021-11-14 21:25:50 -0500
commit401a0d9f8860c7366e06521eb47b686b1290119d (patch)
tree23f34119a22fa067983d5d03ce92bf7442ad308e /.local
parent383b82048621978e4ab65118790907e6fa599e55 (diff)
downloaddotfiles-401a0d9f8860c7366e06521eb47b686b1290119d.tar.gz
dotfiles-401a0d9f8860c7366e06521eb47b686b1290119d.tar.bz2
dotfiles-401a0d9f8860c7366e06521eb47b686b1290119d.zip
.local/bin/nixos-test: Use nix shell shebang
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/nixos-test12
1 files changed, 10 insertions, 2 deletions
diff --git a/.local/bin/nixos-test b/.local/bin/nixos-test
index 3912461..11f43e7 100755
--- a/.local/bin/nixos-test
+++ b/.local/bin/nixos-test
@@ -1,4 +1,7 @@
-#!/bin/sh -eu
+#!/usr/bin/env nix-shell
+#!nix-shell -i dash -p dash gawk moreutils nixos-rebuild nixfmt
+
+set -eu
{ [ "${1:-}" = "-h" ] ||
[ "${1:-}" = "--help" ] ||
@@ -8,8 +11,13 @@
[ -f "$1" ] || { printf "Error: File '%s' not found\n" "$1" && exit; }
+cp "$1" "$1.bak"
+
+nixfmt "$1"
+
awk '!s {s=sub("^{$","{ boot.isContainer = true;")}{ print $0 }' "$1" | sponge "$1"
+awk '!s {s=sub("^in {$","in { boot.isContainer = true;")}{ print $0 }' "$1" | sponge "$1"
NIXOS_CONFIG=$(realpath "$1") nixos-rebuild --fast dry-build || true
-awk '!s {s=sub("{ boot.isContainer = true;","{")}{ print $0 }' "$1" | sponge "$1"
+mv "$1.bak" "$1"