2020-05-03 17:38:23 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, bison
|
|
|
|
, pam
|
2020-05-29 06:06:01 +00:00
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
, withPAM ? true
|
2020-05-29 06:06:01 +00:00
|
|
|
, withTimestamp ? true
|
2020-05-03 17:38:23 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "doas";
|
2020-05-03 17:38:23 +00:00
|
|
|
version = "6.6.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Duncaen";
|
|
|
|
repo = "OpenDoas";
|
|
|
|
rev = "v${version}";
|
2020-05-03 17:38:23 +00:00
|
|
|
sha256 = "07kkc5729p654jrgfsc8zyhiwicgmq38yacmwfvay2b3gmy728zn";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# otherwise confuses ./configure
|
|
|
|
dontDisableStatic = true;
|
|
|
|
|
2020-05-29 06:06:01 +00:00
|
|
|
configureFlags = [
|
|
|
|
(lib.optionalString withTimestamp "--with-timestamp") # to allow the "persist" setting
|
2020-10-16 20:44:37 +00:00
|
|
|
(lib.optionalString (!withPAM) "--without-pam")
|
2020-05-29 06:06:01 +00:00
|
|
|
"--pamdir=${placeholder "out"}/etc/pam.d"
|
|
|
|
];
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Allow doas to discover binaries in /run/current-system/sw/{s,}bin and
|
|
|
|
# /run/wrappers/bin
|
|
|
|
./0001-add-NixOS-specific-dirs-to-safe-PATH.patch
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -i '/\(chown\|chmod\)/d' bsd.prog.mk
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [ bison pam ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Executes the given command as another user";
|
|
|
|
homepage = "https://github.com/Duncaen/OpenDoas";
|
|
|
|
license = licenses.isc;
|
|
|
|
platforms = platforms.linux;
|
2020-05-03 17:38:23 +00:00
|
|
|
maintainers = with maintainers; [ cole-h cstrahan ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|