1 { lib, stdenv, fetchurl, fetchpatch, bison, flex, pam, perl
2 , sendmailPath ? "/run/wrappers/bin/sendmail"
3 , atWrapperPath ? "/run/wrappers/bin/at"
6 stdenv.mkDerivation rec {
11 # Debian is apparently the last location where it can be found.
12 url = "mirror://debian/pool/main/a/at/at_${version}.orig.tar.gz";
13 hash = "sha256-uwZrOJ18m7nYSjVzgDK4XDDLp9lJ91gZKtxyyUd/07g=";
17 # Remove glibc assumption
19 url = "https://raw.githubusercontent.com/riscv/riscv-poky/master/meta/recipes-extended/at/at/0001-remove-glibc-assumption.patch";
20 hash = "sha256-1UobqEZWoaq0S8DUDPuI80kTx0Gut2/VxDIwcKeGZOY=";
25 # Remove chown commands and setuid bit
26 substituteInPlace Makefile.in \
27 --replace ' -o root ' ' ' \
28 --replace ' -g root ' ' ' \
29 --replace ' -o $(DAEMON_USERNAME) ' ' ' \
30 --replace ' -o $(DAEMON_GROUPNAME) ' ' ' \
31 --replace ' -g $(DAEMON_GROUPNAME) ' ' ' \
32 --replace '$(DESTDIR)$(etcdir)' "$out/etc" \
33 --replace '$(DESTDIR)$(ATJOB_DIR)' "$out/var/spool/atjobs" \
34 --replace '$(DESTDIR)$(ATSPOOL_DIR)' "$out/var/spool/atspool" \
35 --replace '$(DESTDIR)$(LFILE)' "$out/var/spool/atjobs/.SEQ" \
36 --replace 'chown' '# skip chown' \
37 --replace '6755' '0755'
40 nativeBuildInputs = [ bison flex perl /* for `prove` (tests) */ ];
42 buildInputs = [ pam ];
46 export SENDMAIL=${sendmailPath}
47 # Purity: force atd.pid to be placed in /var/run regardless of
48 # whether it exists now.
49 substituteInPlace ./configure --replace "test -d /var/run" "true"
53 "--with-etcdir=/etc/at"
54 "--with-jobdir=/var/spool/atjobs"
55 "--with-atspool=/var/spool/atspool"
56 "--with-daemon_username=atd"
57 "--with-daemon_groupname=atd"
62 # Ensure that "batch" can invoke the setuid "at" wrapper, if it exists, or
63 # else we get permission errors (on NixOS). "batch" is a shell script, so
64 # when the kernel executes it drops setuid perms.
66 sed -i "6i test -x ${atWrapperPath} && exec ${atWrapperPath} -qb now # exec doesn't return" "$out/bin/batch"
70 description = "Classical Unix `at' job scheduling command";
71 license = licenses.gpl2Plus;
72 homepage = "https://tracker.debian.org/pkg/at";
73 changelog = "https://salsa.debian.org/debian/at/-/raw/master/ChangeLog";
74 platforms = platforms.linux;