nixpkgs/pkgs/tools/system/at/default.nix
Will Dietz a23be78ef2 at: cross-compilation fixes
* move bison/flex to nativeBuildInputs
* add patch to avoid use of undocumented glibc macro
* fix use of 'install -s' to avoid invoking 'strip' directly
2018-01-09 11:23:56 -05:00

56 lines
1.8 KiB
Nix

{ stdenv, fetchurl, fetchpatch, bison, flex, pam
, sendmailPath ? "/run/wrappers/bin/sendmail"
, atWrapperPath ? "/run/wrappers/bin/at"
}:
stdenv.mkDerivation rec {
name = "at-${version}";
version = "3.1.20";
src = fetchurl {
# Debian is apparently the last location where it can be found.
url = "mirror://debian/pool/main/a/at/at_${version}.orig.tar.gz";
sha256 = "1fgsrqpx0r6qcjxmlsqnwilydhfxn976c870mjc0n1bkmcy94w88";
};
patches = [
./install.patch
(fetchpatch {
url = "https://raw.githubusercontent.com/riscv/riscv-poky/master/meta/recipes-extended/at/at/0001-remove-glibc-assumption.patch";
sha256 = "1rk4hskp0c1jqkanzdxf873i6jgki3xhrm609fsam8an8sl1njnm";
})
];
nativeBuildInputs = [ bison flex ];
buildInputs = [ pam ];
preConfigure =
''
export SENDMAIL=${sendmailPath}
# Purity: force atd.pid to be placed in /var/run regardless of
# whether it exists now.
substituteInPlace ./configure --replace "test -d /var/run" "true"
'';
configureFlags =
''
--with-etcdir=/etc/at
--with-jobdir=/var/spool/atjobs --with-atspool=/var/spool/atspool
--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;
homepage = https://packages.qa.debian.org/at;
platforms = stdenv.lib.platforms.linux;
};
}