From a2b1c19a51b2528af4a7e75e3e1546da56b4c96c Mon Sep 17 00:00:00 2001 From: Nick Hu Date: Sat, 12 Nov 2022 18:33:16 +0000 Subject: Nix feature: allow extra configuration of /etc/nix/nix.conf (#277) --- src/nix/install.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/nix/install.sh') diff --git a/src/nix/install.sh b/src/nix/install.sh index 2fc4367..6141d7e 100755 --- a/src/nix/install.sh +++ b/src/nix/install.sh @@ -9,6 +9,7 @@ VERSION="${VERSION:-"latest"}" MULTIUSER="${MULTIUSER:-"true"}" PACKAGES="${PACKAGES//,/ }" FLAKEURI="${FLAKEURI:-""}" +EXTRANIXCONFIG="${EXTRANIXCONFIG:-""}" USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" # Nix keys for securly verifying installer download signature per https://nixos.org/download.html#nix-verify-installation @@ -99,6 +100,16 @@ create_or_update_file /etc/nix/nix.conf 'sandbox = false' if [ ! -z "${FLAKEURI}" ] && [ "${FLAKEURI}" != "none" ]; then create_or_update_file /etc/nix/nix.conf 'experimental-features = nix-command flakes' fi +# Extra nix config +if [ ! -z "${EXTRANIXCONFIG}" ]; then + OLDIFS=$IFS + IFS="," + read -a extra_nix_config <<< "$EXTRANIXCONFIG" + for line in "${extra_nix_config[@]}"; do + create_or_update_file /etc/nix/nix.conf "$line" + done + IFS=$OLDIFS +fi # Create entrypoint if needed if [ ! -e "/usr/local/share/nix-entrypoint.sh" ]; then -- cgit v1.2.3