From 94659f3326cea9ca55be7816787215dc405b9179 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Tue, 3 Jan 2023 19:36:27 +0100 Subject: [PATCH] examples/deploy-container: fix `sudo` env propagation Env vars can't be reliably passed through `sudo`, so always call nix-shell to setup the env after running sudo. --- examples/deploy-container-minimal.sh | 12 +++--------- examples/deploy-container.sh | 18 ++++++++---------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/examples/deploy-container-minimal.sh b/examples/deploy-container-minimal.sh index d2414fb..fef804f 100755 --- a/examples/deploy-container-minimal.sh +++ b/examples/deploy-container-minimal.sh @@ -1,17 +1,11 @@ #!/usr/bin/env bash set -euo pipefail -if [[ ! -v NIX_BITCOIN_EXAMPLES_DIR ]]; then - echo "Running script in nix shell env..." - cd "${BASH_SOURCE[0]%/*}" - exec nix-shell --run "./${BASH_SOURCE[0]##*/} $*" -else - cd "$NIX_BITCOIN_EXAMPLES_DIR" -fi - tmpDir=$(mktemp -d /tmp/nix-bitcoin-minimal-container.XXX) trap 'rm -rf $tmpDir' EXIT +cd "${BASH_SOURCE[0]%/*}" + # Modify importable-configuration.nix to use the local # source instead of fetchTarball "$tmpDir/configuration.nix" <