Unverified Commit a2b1c19a authored by Nick Hu's avatar Nick Hu Committed by GitHub

Nix feature: allow extra configuration of /etc/nix/nix.conf (#277)

parent f7f05f76
...@@ -25,6 +25,11 @@ ...@@ -25,6 +25,11 @@
"type": "string", "type": "string",
"default": "", "default": "",
"description": "Optional URI to a Nix Flake to install in profile." "description": "Optional URI to a Nix Flake to install in profile."
},
"extraNixConfig": {
"type": "string",
"default": "",
"description": "Optional comma separated list of extra lines to add to /etc/nix/nix.conf."
} }
}, },
"installsAfter": [ "installsAfter": [
......
...@@ -9,6 +9,7 @@ VERSION="${VERSION:-"latest"}" ...@@ -9,6 +9,7 @@ VERSION="${VERSION:-"latest"}"
MULTIUSER="${MULTIUSER:-"true"}" MULTIUSER="${MULTIUSER:-"true"}"
PACKAGES="${PACKAGES//,/ }" PACKAGES="${PACKAGES//,/ }"
FLAKEURI="${FLAKEURI:-""}" FLAKEURI="${FLAKEURI:-""}"
EXTRANIXCONFIG="${EXTRANIXCONFIG:-""}"
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
# Nix keys for securly verifying installer download signature per https://nixos.org/download.html#nix-verify-installation # 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' ...@@ -99,6 +100,16 @@ create_or_update_file /etc/nix/nix.conf 'sandbox = false'
if [ ! -z "${FLAKEURI}" ] && [ "${FLAKEURI}" != "none" ]; then if [ ! -z "${FLAKEURI}" ] && [ "${FLAKEURI}" != "none" ]; then
create_or_update_file /etc/nix/nix.conf 'experimental-features = nix-command flakes' create_or_update_file /etc/nix/nix.conf 'experimental-features = nix-command flakes'
fi 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 # Create entrypoint if needed
if [ ! -e "/usr/local/share/nix-entrypoint.sh" ]; then if [ ! -e "/usr/local/share/nix-entrypoint.sh" ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment