1{ stdenv, fetchurl, coreutils, pam, groff
2, sendmailPath ? "/var/setuid-wrappers/sendmail"
3, withInsults ? false
4}:
5
6stdenv.mkDerivation rec {
7 name = "sudo-1.8.14p3";
8
9 src = fetchurl {
10 urls =
11 [ "ftp://ftp.sudo.ws/pub/sudo/${name}.tar.gz"
12 "ftp://ftp.sudo.ws/pub/sudo/OLD/${name}.tar.gz"
13 ];
14 sha256 = "0dqj1bq2jr4jxqfrd5yg0i42a6268scd0l28jic9118kn75rg9m8";
15 };
16
17 configureFlags = [
18 "--with-env-editor"
19 "--with-editor=/run/current-system/sw/bin/nano"
20 "--with-rundir=/run/sudo"
21 "--with-vardir=/var/db/sudo"
22 "--with-logpath=/var/log/sudo.log"
23 "--with-sendmail=${sendmailPath}"
24 ] ++ stdenv.lib.optional withInsults [
25 "--with-insults"
26 "--with-all-insults"
27 ];
28
29 configureFlagsArray = [
30 "--with-passprompt=[sudo] password for %p: " # intentional trailing space
31 ];
32
33 postConfigure =
34 ''
35 cat >> pathnames.h <<'EOF'
36 #undef _PATH_MV
37 #define _PATH_MV "${coreutils}/bin/mv"
38 EOF
39 makeFlags="install_uid=$(id -u) install_gid=$(id -g)"
40 installFlags="sudoers_uid=$(id -u) sudoers_gid=$(id -g) sysconfdir=$out/etc rundir=$TMPDIR/dummy vardir=$TMPDIR/dummy"
41 '';
42
43 buildInputs = [ coreutils pam groff ];
44
45 enableParallelBuilding = true;
46
47 postInstall =
48 ''
49 rm -f $out/share/doc/sudo/ChangeLog
50 '';
51
52 meta = {
53 description = "A command to run commands as root";
54
55 longDescription =
56 ''
57 Sudo (su "do") allows a system administrator to delegate
58 authority to give certain users (or groups of users) the ability
59 to run some (or all) commands as root or another user while
60 providing an audit trail of the commands and their arguments.
61 '';
62
63 homepage = http://www.sudo.ws/;
64
65 license = http://www.sudo.ws/sudo/license.html;
66
67 maintainers = [ stdenv.lib.maintainers.eelco ];
68
69 platforms = stdenv.lib.platforms.linux;
70 };
71}