nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{lib, stdenv, fetchurl, vim, sendmailPath ? "/usr/sbin/sendmail"}:
2
3stdenv.mkDerivation rec {
4 pname = "cron";
5 version = "4.1";
6
7 src = fetchurl {
8 url = "ftp://ftp.isc.org/isc/cron/cron_${version}.shar";
9 sha256 = "16n3dras4b1jh7g958nz1k54pl9pg5fwb3fvjln8z67varvq6if4";
10 };
11
12 unpackCmd = "(mkdir cron && cd cron && sh $curSrc)";
13
14 hardeningEnable = [ "pie" ];
15
16 preBuild = ''
17 # do not set sticky bit in /nix/store
18 substituteInPlace Makefile --replace ' -o root' ' ' --replace 111 755 --replace 4755 0755
19 # do not strip during install, broken on cross and we'll do ourselves as needed
20 substituteInPlace Makefile --replace ' -s cron' ' cron'
21 makeFlags="DESTROOT=$out CC=$CC"
22
23 # We want to ignore the $glibc/include/paths.h definition of
24 # sendmail path.
25 # Also set a usable default PATH (#16518).
26 cat >> pathnames.h <<__EOT__
27 #undef _PATH_SENDMAIL
28 #define _PATH_SENDMAIL "${sendmailPath}"
29
30 #undef _PATH_VI
31 #define _PATH_VI "${vim}/bin/vim"
32
33 #undef _PATH_DEFPATH
34 #define _PATH_DEFPATH "/run/wrappers/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/usr/bin:/bin"
35 __EOT__
36
37 # Implicit saved uids do not work here due to way NixOS uses setuid wrappers
38 # (#16518).
39 echo "#undef HAVE_SAVED_UIDS" >> externs.h
40 '';
41
42 preInstall = "mkdir -p $out/bin $out/sbin $out/share/man/man1 $out/share/man/man5 $out/share/man/man8";
43
44 meta = with lib; {
45 description = "Daemon for running commands at specific times (Vixie Cron)";
46 license = licenses.bsd0;
47 platforms = with platforms; linux ++ darwin;
48 };
49}