1{ lib, stdenv, fetchFromGitHub, autoreconfHook, makeWrapper, glibc, augeas, dnsutils, c-ares, curl,
2 cyrus_sasl, ding-libs, libnl, libunistring, nss, samba, nfs-utils, doxygen,
3 python3, pam, popt, talloc, tdb, tevent, pkg-config, ldb, openldap,
4 pcre2, libkrb5, cifs-utils, glib, keyutils, dbus, fakeroot, libxslt, libxml2,
5 libuuid, systemd, nspr, check, cmocka, uid_wrapper, p11-kit,
6 nss_wrapper, ncurses, Po4a, http-parser, jansson, jose,
7 docbook_xsl, docbook_xml_dtd_44,
8 nixosTests,
9 withSudo ? false }:
10
11let
12 docbookFiles = "${docbook_xsl}/share/xml/docbook-xsl/catalog.xml:${docbook_xml_dtd_44}/xml/dtd/docbook/catalog.xml";
13in
14stdenv.mkDerivation rec {
15 pname = "sssd";
16 version = "2.8.1";
17
18 src = fetchFromGitHub {
19 owner = "SSSD";
20 repo = pname;
21 rev = version;
22 sha256 = "sha256-TbeofUQAQNM/Nxzgl8GP2+Y4iR7bVXm4dQaPkYMSdqc=";
23 };
24
25 postPatch = ''
26 patchShebangs ./sbus_generate.sh.in
27 '';
28
29 # Something is looking for <libxml/foo.h> instead of <libxml2/libxml/foo.h>
30 NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2";
31
32 preConfigure = ''
33 export SGML_CATALOG_FILES="${docbookFiles}"
34 export PYTHONPATH=$(find ${python3.pkgs.python-ldap} -type d -name site-packages)
35 export PATH=$PATH:${openldap}/libexec
36
37 configureFlagsArray=(
38 --prefix=$out
39 --sysconfdir=/etc
40 --localstatedir=/var
41 --enable-pammoddir=$out/lib/security
42 --with-os=fedora
43 --with-pid-path=/run
44 --with-python3-bindings
45 --with-syslog=journald
46 --without-selinux
47 --without-semanage
48 --with-xml-catalog-path=''${SGML_CATALOG_FILES%%:*}
49 --with-ldb-lib-dir=$out/modules/ldb
50 --with-nscd=${glibc.bin}/sbin/nscd
51 )
52 '' + lib.optionalString withSudo ''
53 configureFlagsArray+=("--with-sudo")
54 '';
55
56 enableParallelBuilding = true;
57 nativeBuildInputs = [ autoreconfHook makeWrapper pkg-config doxygen ];
58 buildInputs = [ augeas dnsutils c-ares curl cyrus_sasl ding-libs libnl libunistring nss
59 samba nfs-utils p11-kit python3 popt
60 talloc tdb tevent ldb pam openldap pcre2 libkrb5
61 cifs-utils glib keyutils dbus fakeroot libxslt libxml2
62 libuuid python3.pkgs.python-ldap systemd nspr check cmocka uid_wrapper
63 nss_wrapper ncurses Po4a http-parser jansson jose ];
64
65 makeFlags = [
66 "SGML_CATALOG_FILES=${docbookFiles}"
67 ];
68
69 installFlags = [
70 "sysconfdir=$(out)/etc"
71 "localstatedir=$(out)/var"
72 "pidpath=$(out)/run"
73 "sss_statedir=$(out)/var/lib/sss"
74 "logpath=$(out)/var/log/sssd"
75 "pubconfpath=$(out)/var/lib/sss/pubconf"
76 "dbpath=$(out)/var/lib/sss/db"
77 "mcpath=$(out)/var/lib/sss/mc"
78 "pipepath=$(out)/var/lib/sss/pipes"
79 "gpocachepath=$(out)/var/lib/sss/gpo_cache"
80 "secdbpath=$(out)/var/lib/sss/secrets"
81 "initdir=$(out)/rc.d/init"
82 ];
83
84 postInstall = ''
85 rm -rf "$out"/run
86 rm -rf "$out"/rc.d
87 rm -f "$out"/modules/ldb/memberof.la
88 find "$out" -depth -type d -exec rmdir --ignore-fail-on-non-empty {} \;
89 '';
90 postFixup = ''
91 for f in $out/bin/sss{ctl,_cache,_debuglevel,_override,_seed}; do
92 wrapProgram $f --prefix LDB_MODULES_PATH : $out/modules/ldb
93 done
94 '';
95
96 passthru.tests = { inherit (nixosTests) sssd sssd-ldap; };
97
98 meta = with lib; {
99 description = "System Security Services Daemon";
100 homepage = "https://sssd.io/";
101 changelog = "https://sssd.io/release-notes/sssd-${version}.html";
102 license = licenses.gpl3Plus;
103 platforms = platforms.linux;
104 maintainers = with maintainers; [ e-user illustris ];
105 };
106}