diff options
author | Aaron Andersen <aaron@fosslib.net> | 2018-08-27 15:24:10 +0000 |
---|---|---|
committer | Aaron Andersen <aaron@fosslib.net> | 2018-08-27 15:24:10 +0000 |
commit | 4d89adcd7292b69765eb7692c7e145b28256b30f (patch) | |
tree | 8dfff201323f8434f861636e76d650219630d786 /pkgs/tools | |
parent | fc1f33bc2c45fbffc6d2217d95e9f64fce509d90 (diff) | |
download | nixlib-4d89adcd7292b69765eb7692c7e145b28256b30f.tar nixlib-4d89adcd7292b69765eb7692c7e145b28256b30f.tar.gz nixlib-4d89adcd7292b69765eb7692c7e145b28256b30f.tar.bz2 nixlib-4d89adcd7292b69765eb7692c7e145b28256b30f.tar.lz nixlib-4d89adcd7292b69765eb7692c7e145b28256b30f.tar.xz nixlib-4d89adcd7292b69765eb7692c7e145b28256b30f.tar.zst nixlib-4d89adcd7292b69765eb7692c7e145b28256b30f.zip |
tweak the PATH variable to better match what NixOS provides
Diffstat (limited to 'pkgs/tools')
-rw-r--r-- | pkgs/tools/system/incron/default.nix | 5 | ||||
-rw-r--r-- | pkgs/tools/system/incron/default_path.patch | 36 |
2 files changed, 39 insertions, 2 deletions
diff --git a/pkgs/tools/system/incron/default.nix b/pkgs/tools/system/incron/default.nix index 8c1b717d6d25..6c708a49b64f 100644 --- a/pkgs/tools/system/incron/default.nix +++ b/pkgs/tools/system/incron/default.nix @@ -7,10 +7,11 @@ stdenv.mkDerivation rec { sha256 = "14cgsfyl43pd86wy40m1xwr7ww023n2jyks66ngybz5s4gbhps6c"; }; - patchPhase = '' + patches = [ ./default_path.patch ]; + + prePatch = '' sed -i "s|PREFIX = /usr/local|PREFIX = $out|g" Makefile sed -i "s|/bin/bash|${bash}/bin/bash|g" usertable.cpp - sed -i "s|/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin|/run/current-system/sw/bin|g" usertable.cpp ''; installPhase = '' diff --git a/pkgs/tools/system/incron/default_path.patch b/pkgs/tools/system/incron/default_path.patch new file mode 100644 index 000000000000..72ef477a92e2 --- /dev/null +++ b/pkgs/tools/system/incron/default_path.patch @@ -0,0 +1,36 @@ +diff --git usertable.cpp usertable.cpp +index 11fd04b..a8681bd 100644 +--- a/usertable.cpp ++++ b/usertable.cpp +@@ -43,9 +43,6 @@ + #define DONT_FOLLOW(mask) (false) + #endif // IN_DONT_FOLLOW + +-// this is not enough, but... +-#define DEFAULT_PATH "/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin" +- + + PROC_MAP UserTable::s_procMap; + +@@ -597,12 +594,20 @@ void UserTable::RunAsUser(std::string cmd) const + if (clearenv() != 0) + goto failed; + ++ // try to recreate the user path as best as possible ++ std::string DEFAULT_PATH; ++ DEFAULT_PATH += "/run/wrappers/bin:/home/"; ++ DEFAULT_PATH += pwd->pw_name; ++ DEFAULT_PATH += "/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/etc/profiles/per-user/"; ++ DEFAULT_PATH += pwd->pw_name; ++ DEFAULT_PATH += "/bin"; ++ + if ( setenv("LOGNAME", pwd->pw_name, 1) != 0 + || setenv("USER", pwd->pw_name, 1) != 0 + || setenv("USERNAME", pwd->pw_name, 1) != 0 + || setenv("HOME", pwd->pw_dir, 1) != 0 + || setenv("SHELL", pwd->pw_shell, 1) != 0 +- || setenv("PATH", DEFAULT_PATH, 1) != 0) ++ || setenv("PATH", DEFAULT_PATH.c_str(), 1) != 0) + { + goto failed; + } |