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 testers, nix-update-script, 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 (finalAttrs: {
15 pname = "sssd";
16 version = "2.9.3";
17
18 src = fetchFromGitHub {
19 owner = "SSSD";
20 repo = "sssd";
21 rev = "refs/tags/${finalAttrs.version}";
22 hash = "sha256-WTVOt2TpTCyMmFYzWJMBQdwgmov7m1Sd8CwyL4ywPUY=";
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 env.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 # Disable parallel install due to missing depends:
58 # libtool: error: error: relink '_py3sss.la' with the above command before installing i
59 enableParallelInstalling = false;
60 nativeBuildInputs = [ autoreconfHook makeWrapper pkg-config doxygen ];
61 buildInputs = [ augeas dnsutils c-ares curl cyrus_sasl ding-libs libnl libunistring nss
62 samba nfs-utils p11-kit python3 popt
63 talloc tdb tevent ldb pam openldap pcre2 libkrb5
64 cifs-utils glib keyutils dbus fakeroot libxslt libxml2
65 libuuid python3.pkgs.python-ldap systemd nspr check cmocka uid_wrapper
66 nss_wrapper ncurses Po4a http-parser jansson jose ];
67
68 makeFlags = [
69 "SGML_CATALOG_FILES=${docbookFiles}"
70 ];
71
72 installFlags = [
73 "sysconfdir=$(out)/etc"
74 "localstatedir=$(out)/var"
75 "pidpath=$(out)/run"
76 "sss_statedir=$(out)/var/lib/sss"
77 "logpath=$(out)/var/log/sssd"
78 "pubconfpath=$(out)/var/lib/sss/pubconf"
79 "dbpath=$(out)/var/lib/sss/db"
80 "mcpath=$(out)/var/lib/sss/mc"
81 "pipepath=$(out)/var/lib/sss/pipes"
82 "gpocachepath=$(out)/var/lib/sss/gpo_cache"
83 "secdbpath=$(out)/var/lib/sss/secrets"
84 "initdir=$(out)/rc.d/init"
85 ];
86
87 postInstall = ''
88 rm -rf "$out"/run
89 rm -rf "$out"/rc.d
90 rm -f "$out"/modules/ldb/memberof.la
91 find "$out" -depth -type d -exec rmdir --ignore-fail-on-non-empty {} \;
92 '';
93 postFixup = ''
94 for f in $out/bin/sss{ctl,_cache,_debuglevel,_override,_seed}; do
95 wrapProgram $f --prefix LDB_MODULES_PATH : $out/modules/ldb
96 done
97 '';
98
99 passthru = {
100 tests = {
101 inherit (nixosTests) sssd sssd-ldap;
102 version = testers.testVersion {
103 package = finalAttrs.finalPackage;
104 command = "sssd --version";
105 };
106 };
107 updateScript = nix-update-script { };
108 };
109
110 meta = with lib; {
111 description = "System Security Services Daemon";
112 homepage = "https://sssd.io/";
113 changelog = "https://sssd.io/release-notes/sssd-${finalAttrs.version}.html";
114 license = licenses.gpl3Plus;
115 platforms = platforms.linux;
116 maintainers = with maintainers; [ illustris ];
117 };
118})