2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-05-03 17:38:23 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, bison
|
|
|
|
, pam
|
2022-11-02 22:02:43 +00:00
|
|
|
, libxcrypt
|
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";
|
2022-01-27 00:19:43 +00:00
|
|
|
version = "6.8.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Duncaen";
|
|
|
|
repo = "OpenDoas";
|
|
|
|
rev = "v${version}";
|
2022-01-27 00:19:43 +00:00
|
|
|
sha256 = "9uOQ2Ta5HzEpbCz2vbqZEEksPuIjL8lvmfmynfqxMeM=";
|
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
|
|
|
];
|
|
|
|
|
|
|
|
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-07-15 17:15:38 +00:00
|
|
|
# ./configure script does not understand `--disable-shared`
|
|
|
|
dontAddStaticConfigureFlags = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
2020-12-03 08:41:04 +00:00
|
|
|
sed -i '/\(chown\|chmod\)/d' GNUmakefile
|
2022-11-21 17:40:18 +00:00
|
|
|
'' + lib.optionalString (withPAM && stdenv.hostPlatform.isStatic) ''
|
|
|
|
sed -i 's/-lpam/-lpam -laudit/' configure
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
nativeBuildInputs = [ bison ];
|
2022-11-02 22:02:43 +00:00
|
|
|
buildInputs = [ ]
|
|
|
|
++ lib.optional withPAM pam
|
|
|
|
++ lib.optional (!withPAM) libxcrypt;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Executes the given command as another user";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "doas";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/Duncaen/OpenDoas";
|
|
|
|
license = licenses.isc;
|
|
|
|
platforms = platforms.linux;
|
2023-10-09 19:29:22 +00:00
|
|
|
maintainers = with maintainers; [ cole-h ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|