diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2018-08-31 06:54:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-31 06:54:58 +0100 |
commit | f0136e4bc85b5cadd72671b513ecf24a576a046f (patch) | |
tree | 07a70e313f8f730d80b9e332c507005904cdf837 /pkgs/tools/system | |
parent | b11e4ed9996c36b6e80c488611a223ad048be82b (diff) | |
parent | 9b12db6928543dd33a02e7964e82e2291c48a3f0 (diff) | |
download | nixlib-f0136e4bc85b5cadd72671b513ecf24a576a046f.tar nixlib-f0136e4bc85b5cadd72671b513ecf24a576a046f.tar.gz nixlib-f0136e4bc85b5cadd72671b513ecf24a576a046f.tar.bz2 nixlib-f0136e4bc85b5cadd72671b513ecf24a576a046f.tar.lz nixlib-f0136e4bc85b5cadd72671b513ecf24a576a046f.tar.xz nixlib-f0136e4bc85b5cadd72671b513ecf24a576a046f.tar.zst nixlib-f0136e4bc85b5cadd72671b513ecf24a576a046f.zip |
Merge pull request #45638 from aanderse/incron
incron: init at 0.5.12
Diffstat (limited to 'pkgs/tools/system')
-rw-r--r-- | pkgs/tools/system/incron/default.nix | 36 | ||||
-rw-r--r-- | pkgs/tools/system/incron/default_path.patch | 36 |
2 files changed, 72 insertions, 0 deletions
diff --git a/pkgs/tools/system/incron/default.nix b/pkgs/tools/system/incron/default.nix new file mode 100644 index 000000000000..2afbed2f9bb2 --- /dev/null +++ b/pkgs/tools/system/incron/default.nix @@ -0,0 +1,36 @@ +{ stdenv, fetchFromGitHub, bash }: + +stdenv.mkDerivation rec { + name = "incron-0.5.12"; + src = fetchFromGitHub { + owner = "ar-"; + repo = "incron"; + rev = name; + sha256 = "11d5f98cjafiv9h9zzzrw2s06s2fvdg8gp64km7mdprd2xmy6dih"; + }; + + patches = [ ./default_path.patch ]; + + prePatch = '' + sed -i "s|/bin/bash|${bash}/bin/bash|g" usertable.cpp + ''; + + installFlags = [ "PREFIX=$(out)" ]; + installTargets = [ "install-man" ]; + + preInstall = '' + mkdir -p $out/bin + + # make install doesn't work because setuid and permissions + # just manually install the binaries instead + cp incrond incrontab $out/bin/ + ''; + + meta = with stdenv.lib; { + description = "A cron-like daemon which handles filesystem events."; + homepage = https://github.com/ar-/incron; + license = licenses.gpl2; + maintainers = [ maintainers.aanderse ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/tools/system/incron/default_path.patch b/pkgs/tools/system/incron/default_path.patch new file mode 100644 index 000000000000..ae173ea29e62 --- /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:"; ++ DEFAULT_PATH += pwd->pw_dir; ++ 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; + } |