Skip to content

Commit

Permalink
nixos/test-instrumentation: fix shellcheck findings with enableStrict…
Browse files Browse the repository at this point in the history
…ShellChecks enabled

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
  • Loading branch information
Scrumplex committed Jan 13, 2025
1 parent b792bab commit 5c30f8c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion nixos/modules/testing/test-instrumentation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,19 @@ let
export HOME=/root
export DISPLAY=:0.0
# Determine if this script is ran with nounset
strict="false"
if set -o | grep --quiet --perl-regexp "nounset\s+on"; then
strict="true"
fi
if [[ -e /etc/profile ]]; then
# TODO: Currently shell profiles are not checked at build time,
# so we need to unset stricter options to source them
set +o nounset
# shellcheck disable=SC1091
source /etc/profile
[ "$strict" = "true" ] && set -o nounset
fi
# Don't use a pager when executing backdoor
Expand All @@ -45,7 +56,7 @@ let
# we can also run non-NixOS guests during tests. This, however, is
# mostly futureproofing as the test instrumentation is still very
# tightly coupled to NixOS.
PS1= exec ${pkgs.coreutils}/bin/env bash --norc /dev/hvc0
PS1="" exec ${pkgs.coreutils}/bin/env bash --norc /dev/hvc0
'';
serviceConfig.KillSignal = "SIGHUP";
};
Expand Down

0 comments on commit 5c30f8c

Please sign in to comment.