spacepaste

  1.  
  2. { stdenv, fetchurl, coreutils, pam, groff
  3. , sendmailPath ? "/run/wrappers/bin/sendmail"
  4. , withInsults ? false
  5. , withSssd ? false
  6. }:
  7. stdenv.mkDerivation rec {
  8. name = "sudo-1.8.20p2";
  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 = "1na5likm1srnd1g5sjx7b0543sczw0yppacyqsazfdg9b48awhmx";
  15. };
  16. prePatch = ''
  17. # do not set sticky bit in nix store
  18. substituteInPlace src/Makefile.in --replace 04755 0755
  19. '';
  20. configureFlags = [
  21. "--with-env-editor"
  22. "--with-editor=/run/current-system/sw/bin/nano"
  23. "--with-rundir=/run/sudo"
  24. "--with-vardir=/var/db/sudo"
  25. "--with-logpath=/var/log/sudo.log"
  26. "--with-iologdir=/var/log/sudo-io"
  27. "--with-sendmail=${sendmailPath}"
  28. ] ++ stdenv.lib.optional withInsults [
  29. "--with-insults"
  30. "--with-all-insults"
  31. ] ++ stdenv.lib.optional withSssd [
  32. "--with-sssd"
  33. "--with-sssd-lib=${sssd}/lib"
  34. ];
  35. configureFlagsArray = [
  36. "--with-passprompt=[sudo] password for %p: " # intentional trailing space
  37. ];
  38. postConfigure =
  39. ''
  40. cat >> pathnames.h <<'EOF'
  41. #undef _PATH_MV
  42. #define _PATH_MV "${coreutils}/bin/mv"
  43. EOF
  44. makeFlags="install_uid=$(id -u) install_gid=$(id -g)"
  45. installFlags="sudoers_uid=$(id -u) sudoers_gid=$(id -g) sysconfdir=$out/etc rundir=$TMPDIR/dummy vardir=$TMPDIR/dummy"
  46. '';
  47. buildInputs = [ coreutils pam groff ] ++ stdenv.lib.optionals withSssd [ sssd ];
  48. enableParallelBuilding = true;
  49. postInstall =
  50. ''
  51. rm -f $out/share/doc/sudo/ChangeLog
  52. '';
  53. meta = {
  54. description = "A command to run commands as root";
  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. homepage = http://www.sudo.ws/;
  63. license = http://www.sudo.ws/sudo/license.html;
  64. maintainers = [ stdenv.lib.maintainers.eelco ];
  65. platforms = stdenv.lib.platforms.linux;
  66. };
  67. }
  68.