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.17p1";
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 = "c690d707fb561b3ecdf6a6de5563bc0b769388eff201c851edbace408bb155cc";
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-iologdir=/var/log/sudo-io"
24 "--with-sendmail=${sendmailPath}"
25 ] ++ stdenv.lib.optional withInsults [
26 "--with-insults"
27 "--with-all-insults"
28 ];
29
30 configureFlagsArray = [
31 "--with-passprompt=[sudo] password for %p: " # intentional trailing space
32 ];
33
34 postConfigure =
35 ''
36 cat >> pathnames.h <<'EOF'
37 #undef _PATH_MV
38 #define _PATH_MV "${coreutils}/bin/mv"
39 EOF
40 makeFlags="install_uid=$(id -u) install_gid=$(id -g)"
41 installFlags="sudoers_uid=$(id -u) sudoers_gid=$(id -g) sysconfdir=$out/etc rundir=$TMPDIR/dummy vardir=$TMPDIR/dummy"
42 '';
43
44 buildInputs = [ coreutils pam groff ];
45
46 enableParallelBuilding = true;
47
48 postInstall =
49 ''
50 rm -f $out/share/doc/sudo/ChangeLog
51 '';
52
53 meta = {
54 description = "A command to run commands as root";
55
56 longDescription =
57 ''
58 Sudo (su "do") allows a system administrator to delegate
59 authority to give certain users (or groups of users) the ability
60 to run some (or all) commands as root or another user while
61 providing an audit trail of the commands and their arguments.
62 '';
63
64 homepage = http://www.sudo.ws/;
65
66 license = http://www.sudo.ws/sudo/license.html;
67
68 maintainers = [ stdenv.lib.maintainers.eelco ];
69
70 platforms = stdenv.lib.platforms.linux;
71 };
72}