nixos-container: avoid subshell when testing $PRIVATE_USERS

So that the script is not rejected by https://www.shellcheck.net/wiki/SC2235
 under `systemd.enableStrictShellChecks = true;`
This commit is contained in:
Jean-Baptiste Giraudeau 2025-02-18 09:41:55 +01:00
parent a0d86441b5
commit 57c96ff6ef
No known key found for this signature in database
GPG key ID: 7CEF8C9CC2D9933B

View file

@ -118,7 +118,7 @@ let
NIX_BIND_OPT=""
if [ -n "$PRIVATE_USERS" ]; then
extraFlags+=("--private-users=$PRIVATE_USERS")
if [ "$PRIVATE_USERS" = "pick" ] || ( [ "$PRIVATE_USERS" != "identity" ] && [ "$PRIVATE_USERS" -gt 0 ] ); then
if [ "$PRIVATE_USERS" = "pick" ] || { [ "$PRIVATE_USERS" != "identity" ] && [ "$PRIVATE_USERS" -gt 0 ]; }; then
# when user namespacing is enabled, we use `idmap` mount option
# so that bind mounts under /nix get proper owner (and not nobody/nogroup).
NIX_BIND_OPT=":idmap"