diff --git a/src/usr/local/containerbase/tools/v2/nix.sh b/src/usr/local/containerbase/tools/v2/nix.sh index 5ad6cf967a..dd51b2c899 100644 --- a/src/usr/local/containerbase/tools/v2/nix.sh +++ b/src/usr/local/containerbase/tools/v2/nix.sh @@ -10,6 +10,11 @@ function install_tool() { local file local arch + # if [[ ${MAJOR} -lt 2 || (${MAJOR} -eq 2 && ${MINOR} -lt 14) ]]; then + # echo "Nix version ${TOOL_VERSION} is not supported! Use v2.14 or higher." >&2 + # exit 1 + # fi + arch=$(uname -m) file=$(get_from_url "https://hydra.nixos.org/job/nix/maintenance-${TOOL_VERSION}/buildStatic.${arch}-linux/latest/download-by-type/file/binary-dist") @@ -23,6 +28,6 @@ function link_tool() { local versioned_tool_path versioned_tool_path=$(find_versioned_tool_path) - shell_wrapper "${TOOL_NAME}" "${versioned_tool_path}/bin" + shell_wrapper "${TOOL_NAME}" "${versioned_tool_path}/bin" "NIX_STORE_DIR=$(get_home_path)/nix/store NIX_DATA_DIR=$(get_home_path)/nix/data NIX_LOG_DIR=$(get_cache_path)/nix/log NIX_STATE_DIR=$(get_home_path)/nix/state NIX_CONF_DIR=$(get_home_path)/nix/conf" [[ -n $SKIP_VERSION ]] || nix --version } diff --git a/src/usr/local/containerbase/utils/filesystem.sh b/src/usr/local/containerbase/utils/filesystem.sh index 42976ea73a..8c10129bf0 100644 --- a/src/usr/local/containerbase/utils/filesystem.sh +++ b/src/usr/local/containerbase/utils/filesystem.sh @@ -74,7 +74,7 @@ function setup_directories () { # shellcheck disable=SC2174 mkdir -p -m 775 "${home_path}" # shellcheck disable=SC2174 - mkdir -p -m 775 "${home_path}"/{.config,.local} + mkdir -p -m 775 "${home_path}"/{.cache,.config,.local} # symlink v2 tools bin and lib rm -rf "${BIN_DIR}" "${LIB_DIR}" diff --git a/src/usr/local/containerbase/utils/linking.sh b/src/usr/local/containerbase/utils/linking.sh index 6dd0438b43..b480b0e1ef 100644 --- a/src/usr/local/containerbase/utils/linking.sh +++ b/src/usr/local/containerbase/utils/linking.sh @@ -6,6 +6,7 @@ function shell_wrapper () { local SOURCE=$2 local EXPORTS=$3 local args=$4 + local content=$5 TARGET="$(get_bin_path)/${1}" if [[ -z "$SOURCE" ]]; then SOURCE=$(command -v "${1}") @@ -28,6 +29,10 @@ EOM echo "export $EXPORTS" >> "$TARGET" fi + if [ -n "$content" ]; then + echo "$content" >> "$TARGET" + fi + echo "${SOURCE} ${args} \"\$@\"" >> "$TARGET" set_file_owner "${TARGET}" 775 diff --git a/test/nix/Dockerfile b/test/nix/Dockerfile index 3a78ecb37e..080a367fb4 100644 --- a/test/nix/Dockerfile +++ b/test/nix/Dockerfile @@ -77,6 +77,9 @@ RUN set -ex; \ --extra-experimental-features flakes \ flake update +RUN set -ex; \ + ls -la $USER_HOME; \ + true #-------------------------------------- # final #--------------------------------------