WNFTZY3MQBNYY2V6XEI2DHZEZGRUMVWK23IN34YW3OISLSJHGFYQC
4A2DSMIMTZQWWZU76RCPYE2HYIGDBHQNZPRSJMQ4Y6T3CTFUZTEQC
EINBKIWAZ5ISQNMEOQL2SLC5ON57XUFVHXT3KNYSVNFYV6FDXSMQC
W2G433QU3JDG72JL6GYR6E5HMAHFP3OF2DLFB3O42245XTE6VGZQC
HCY72TQRK2H7LRTEPPHDWTUVINPHZBGMTASY7FJRYS2WXCBRSMYQC
M5U5PAX7ACFUIJKG2CLQKLEFF76KYMGI7WRZXFLOBR5LYBDEWFFAC
P34QQPLUIK567SGFSQYG7UWHNKWNSZ3U5JFA7P7ZPXMNGTNOT25AC
JGZ7GBCLGDQVN7FOJMXAR5BEB4MV6F4F2CIMUCIUV7E52AFIUFRAC
SNO57YN4UEBJSBUF2XYF6NH4BLMK2TPR4FJIX3WZPKUQGGYBBYEQC
52F4Q6CJCVIEVT576TSP2YUN54ZCEFXHYZWNV4BGHWDASTURAXFQC
7AUC4NKIYIKUZMHNOVCCVGPDO3BO3D56XULZXTXRFBTPDG27J7DQC
UWWBKZ4RKVV6ZRR6AFGVTRFYEB546ZRXKJPW5YPWPRENEI3EGVQQC
AG72J7RH2V7GWYMGULESKCIK72FZ64EZKZO5EQQVSYTOCFGGJ3SAC
VXZ5QMIEF5MRBUALM5HPRLOCJ2CCCS3D4QNOB5T2W56NAOCD5CXAC
echo "${BASH_SOURCE[0]}"
${shellcheck_cmd} "${BASH_SOURCE[0]}" || return 1
echo "$(dirname "${BASH_SOURCE[0]}")/bash/nix-container-demo-helper.sh"
${shellcheck_cmd} "$(dirname "${BASH_SOURCE[0]}")/bash/nix-container-demo-helper.sh" || return 1
}
__nix_make_gcroot() {
local -r storepath="${1}"
echo "Preventing GC for '${storepath}'"
local -r gcroot="/nix/var/nix/gcroots/per-user/${USER}/nix-container-demo-$(basename "${storepath}")"
rm -f "${gcroot}"
ln -s "${storepath}" "${gcroot}"
}
nix() {
if [ "${WRAP_NIX_MAKE_GCROOTS:-0}" = 0 ]; then
command nix "$@"
else
local -r action=$1
shift
local nix_args=()
local args=()
local __encountered_dashes=0
while [ $# -gt 0 ]; do
if [ "$1" == "--" ]; then
__encountered_dashes=1
elif [ "${__encountered_dashes}" = 1 ]; then
args+=("$1")
else
nix_args+=("$1")
fi
shift
done
local storepath
if [ "${action}" = run ]; then
command nix run "${nix_args[@]}" -- "${args[@]}"
for storepath in $(command nix build "${nix_args[@]}" --no-link --print-out-paths); do
__nix_make_gcroot "${storepath}"
done
elif [ "${action}" = build ]; then
command nix build "${nix_args[@]}"
for storepath in $(command nix build "${nix_args[@]}" --no-link --print-out-paths); do
__nix_make_gcroot "${storepath}"
done
elif [ "${action}" = develop ]; then
# shellcheck disable=SC2016
storepath="$(command nix develop "${nix_args[0]}" --command bash -c 'echo ${NIX_GCROOT}' 2>/dev/null)"
__nix_make_gcroot "${storepath}"
command nix develop "${nix_args[@]}"
else
command nix "${action}" "${nix_args[@]}"
fi
fi
-l|--lint: run linter on shell files
-a|--auto: run in automatic mode (no pausing)
-h|--help|-?: Show usage
-h|--help|-?: Show usage"
-a|--auto: run in automatic mode (no pausing)"
-g|--gcroots: create Nix garbage collector roots for nix build/run/develop outputs"
-l|--lint: run linter on shell files"