1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-04-08 18:20:48 +00:00

installer and activation: Sanitise PATH

This makes sure that the installation and activation processes are “pure”,
i.e. they use only binaries from nixpkgs or ones that come with macOS.

Closes .
This commit is contained in:
Kirill Elagin 2018-06-29 18:32:09 +03:00
parent 9f18c93771
commit 26bab2fd32
2 changed files with 6 additions and 3 deletions
modules/system
pkgs/darwin-installer

View file

@ -40,7 +40,7 @@ in
#! ${stdenv.shell}
set -e
set -o pipefail
export PATH=${pkgs.coreutils}/bin:@out@/sw/bin:${config.environment.systemPath}
export PATH="${pkgs.gnugrep}/bin:${pkgs.coreutils}/bin:@out@/sw/bin:/usr/bin:/bin"
systemConfig=@out@
@ -83,7 +83,7 @@ in
#! ${stdenv.shell}
set -e
set -o pipefail
export PATH=${pkgs.coreutils}/bin:@out@/sw/bin:${config.environment.systemPath}
export PATH="${pkgs.gnugrep}/bin:${pkgs.coreutils}/bin:@out@/sw/bin:/usr/bin:/bin"
systemConfig=@out@

View file

@ -24,6 +24,9 @@ stdenv.mkDerivation {
shellHook = ''
set -e
orig_path="$PATH"
export PATH="${pkgs.openssh}/bin" # In case nix needs it
action=switch
while [ "$#" -gt 0 ]; do
i="$1"; shift 1
@ -58,7 +61,7 @@ stdenv.mkDerivation {
read -p "Would you like edit the default configuration.nix before starting? [y/n] " i
case "$i" in
y|Y)
''${EDITOR:-nano} "$config"
PATH="$orig_path" ''${EDITOR:-nano} "$config"
;;
esac
fi