2021-01-28 22:01:34 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-02-10 02:10:24 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, bison
|
|
|
|
, pam
|
2022-11-01 15:29:45 +00:00
|
|
|
, libxcrypt
|
2020-05-17 18:25:04 +00:00
|
|
|
|
2020-07-27 23:40:50 +00:00
|
|
|
, withPAM ? true
|
2020-05-17 18:25:04 +00:00
|
|
|
, withTimestamp ? true
|
2020-02-10 02:10:24 +00:00
|
|
|
}:
|
2017-11-07 20:43:06 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "doas";
|
2022-01-26 16:52:33 +00:00
|
|
|
version = "6.8.2";
|
2017-11-07 20:43:06 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Duncaen";
|
|
|
|
repo = "OpenDoas";
|
|
|
|
rev = "v${version}";
|
2022-01-26 16:52:33 +00:00
|
|
|
sha256 = "9uOQ2Ta5HzEpbCz2vbqZEEksPuIjL8lvmfmynfqxMeM=";
|
2017-11-07 20:43:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# otherwise confuses ./configure
|
|
|
|
dontDisableStatic = true;
|
|
|
|
|
2020-05-17 18:25:04 +00:00
|
|
|
configureFlags = [
|
|
|
|
(lib.optionalString withTimestamp "--with-timestamp") # to allow the "persist" setting
|
2020-07-27 23:40:50 +00:00
|
|
|
(lib.optionalString (!withPAM) "--without-pam")
|
2020-05-17 18:25:04 +00:00
|
|
|
];
|
|
|
|
|
2020-05-27 05:57:30 +00:00
|
|
|
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
|
|
|
|
];
|
|
|
|
|
2023-06-06 01:42:31 +00:00
|
|
|
# ./configure script does not understand `--disable-shared`
|
|
|
|
dontAddStaticConfigureFlags = true;
|
|
|
|
|
2017-11-07 20:43:06 +00:00
|
|
|
postPatch = ''
|
2020-11-15 03:14:54 +00:00
|
|
|
sed -i '/\(chown\|chmod\)/d' GNUmakefile
|
2022-11-01 00:23:31 +00:00
|
|
|
'' + lib.optionalString (withPAM && stdenv.hostPlatform.isStatic) ''
|
|
|
|
sed -i 's/-lpam/-lpam -laudit/' configure
|
2017-11-07 20:43:06 +00:00
|
|
|
'';
|
|
|
|
|
2022-05-27 04:13:39 +00:00
|
|
|
nativeBuildInputs = [ bison ];
|
2022-11-01 15:29:45 +00:00
|
|
|
buildInputs = [ ]
|
|
|
|
++ lib.optional withPAM pam
|
|
|
|
++ lib.optional (!withPAM) libxcrypt;
|
2017-11-07 20:43:06 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Executes the given command as another user";
|
|
|
|
homepage = "https://github.com/Duncaen/OpenDoas";
|
|
|
|
license = licenses.isc;
|
|
|
|
platforms = platforms.linux;
|
2020-02-10 02:10:24 +00:00
|
|
|
maintainers = with maintainers; [ cole-h cstrahan ];
|
2017-11-07 20:43:06 +00:00
|
|
|
};
|
|
|
|
}
|