File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 113113chmod +x,o+r ${FEATURE_DIR} ${FEATURE_DIR} /post-install-steps.sh
114114if [ " ${MULTIUSER} " = " true" ]; then
115115 /usr/local/share/nix-entrypoint.sh
116- su ${USERNAME} -c "
117- . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
118- ${FEATURE_DIR} /post-install-steps.sh
119- "
116+ . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
117+ NIX_FEATURE_INSTALL_PROFILE=/nix/var/nix/profiles/default ${FEATURE_DIR} /post-install-steps.sh
120118else
121119 su ${USERNAME} -c "
122120 . \$ HOME/.nix-profile/etc/profile.d/nix.sh
Original file line number Diff line number Diff line change 22set -e
33echo " (*) Executing post-installation steps..."
44
5+ # In multi-user mode, install into the default profile that is on PATH.
6+ NIX_ENV_PROFILE_ARGS=()
7+ NIX_PROFILE_INSTALL_ARGS=()
8+ if [ -n " ${NIX_FEATURE_INSTALL_PROFILE} " ]; then
9+ NIX_ENV_PROFILE_ARGS=(-p " ${NIX_FEATURE_INSTALL_PROFILE} " )
10+ NIX_PROFILE_INSTALL_ARGS=(--profile " ${NIX_FEATURE_INSTALL_PROFILE} " )
11+ fi
12+
513# if not starts with "nixpkgs." add it as prefix to package name
614add_nixpkgs_prefix () {
715 local packages=$1
@@ -20,17 +28,17 @@ if [ ! -z "${PACKAGES}" ] && [ "${PACKAGES}" != "none" ]; then
2028 if [ " ${USEATTRIBUTEPATH} " = " true" ]; then
2129 PACKAGES=$( add_nixpkgs_prefix " $PACKAGES " )
2230 echo " Installing packages \" ${PACKAGES} \" in profile..."
23- nix-env -iA ${PACKAGES}
31+ nix-env " ${NIX_ENV_PROFILE_ARGS[@]} " -iA ${PACKAGES}
2432 else
2533 echo " Installing packages \" ${PACKAGES} \" in profile..."
26- nix-env --install ${PACKAGES}
34+ nix-env " ${NIX_ENV_PROFILE_ARGS[@]} " --install ${PACKAGES}
2735 fi
2836fi
2937
3038# Install Nix flake in profile if specified
3139if [ ! -z " ${FLAKEURI} " ] && [ " ${FLAKEURI} " != " none" ]; then
3240 echo " Installing flake ${FLAKEURI} in profile..."
33- nix profile install " ${FLAKEURI} "
41+ nix profile install " ${NIX_PROFILE_INSTALL_ARGS[@]} " " ${FLAKEURI} "
3442fi
3543
3644nix-collect-garbage --delete-old
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ check "nix-env" type nix-env
2929check " vim_installed" type vim
3030check " node_installed" type node
3131check " yarn_installed" type yarn
32+ check " vim_in_default_profile" bash -lc " nix-env -p /nix/var/nix/profiles/default -q | grep -q '^vim'"
3233
3334# Report result
3435# If any of the checks above exited with a non-zero exit code, the test will fail.
You can’t perform that action at this time.
0 commit comments