about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2017-10-14 22:35:53 +0200
committerBjørn Forsman <bjorn.forsman@gmail.com>2017-10-16 19:08:19 +0200
commit38e6ae8e440d3c1eb53c7f2bae9dedd2fdf9a5bb (patch)
treef28112f56c6214a0ef4b99f50bc9375d6de1d635 /pkgs/tools
parent635fbcbd33e80663824164bd17571cc45c8bb934 (diff)
downloadnixlib-38e6ae8e440d3c1eb53c7f2bae9dedd2fdf9a5bb.tar
nixlib-38e6ae8e440d3c1eb53c7f2bae9dedd2fdf9a5bb.tar.gz
nixlib-38e6ae8e440d3c1eb53c7f2bae9dedd2fdf9a5bb.tar.bz2
nixlib-38e6ae8e440d3c1eb53c7f2bae9dedd2fdf9a5bb.tar.lz
nixlib-38e6ae8e440d3c1eb53c7f2bae9dedd2fdf9a5bb.tar.xz
nixlib-38e6ae8e440d3c1eb53c7f2bae9dedd2fdf9a5bb.tar.zst
nixlib-38e6ae8e440d3c1eb53c7f2bae9dedd2fdf9a5bb.zip
at: fix permission errors with "batch" on NixOS
Fixes https://github.com/NixOS/nixpkgs/issues/12392
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/system/at/default.nix12
1 files changed, 11 insertions, 1 deletions
diff --git a/pkgs/tools/system/at/default.nix b/pkgs/tools/system/at/default.nix
index 501a1bde33b3..cc4ccdd40f09 100644
--- a/pkgs/tools/system/at/default.nix
+++ b/pkgs/tools/system/at/default.nix
@@ -1,4 +1,7 @@
-{ fetchurl, stdenv, bison, flex, pam, sendmailPath ? "/run/wrappers/bin/sendmail" }:
+{ fetchurl, stdenv, bison, flex, pam
+, sendmailPath ? "/run/wrappers/bin/sendmail"
+, atWrapperPath ? "/run/wrappers/bin/at"
+}:
 
 stdenv.mkDerivation rec {
   name = "at-${version}";
@@ -30,6 +33,13 @@ stdenv.mkDerivation rec {
        --with-daemon_username=atd --with-daemon_groupname=atd
     '';
 
+  # Ensure that "batch" can invoke the setuid "at" wrapper, if it exists, or
+  # else we get permission errors (on NixOS). "batch" is a shell script, so
+  # when the kernel executes it it drops setuid perms.
+  postInstall = ''
+    sed -i "6i test -x ${atWrapperPath} && exec ${atWrapperPath} -qb now  # exec doesn't return" "$out/bin/batch"
+  '';
+
   meta = {
     description = ''The classical Unix `at' job scheduling command'';
     license = stdenv.lib.licenses.gpl2Plus;