1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 bash,
6 coreutils,
7 gnugrep,
8 gnused,
9 jq,
10 lldap,
11 unixtools,
12 curl,
13 makeWrapper,
14 unstableGitUpdater,
15}:
16stdenv.mkDerivation {
17 pname = "lldap-cli";
18 version = "0-unstable-2025-01-19";
19
20 src = fetchFromGitHub {
21 owner = "Zepmann";
22 repo = "lldap-cli";
23 rev = "e383494b4dd89ae4e028958b268e200fd85a7a64";
24 hash = "sha256-k6UDLOyP+EvKmC1TmbMObgAw2IIs7ekIZxJOWbwc+jg=";
25 };
26
27 nativeBuildInputs = [ makeWrapper ];
28
29 patchPhase = ''
30 runHook prePatch
31
32 # fix .lldap-cli-wrapped showing up in usage
33 substituteInPlace lldap-cli \
34 --replace-fail '$(basename $0)' lldap-cli
35
36 runHook postPatch
37 '';
38
39 dontConfigure = true;
40 dontBuild = true;
41
42 installPhase = ''
43 install -Dm555 lldap-cli -t $out/bin
44 wrapProgram $out/bin/lldap-cli \
45 --prefix PATH : ${
46 lib.makeBinPath [
47 bash
48 unixtools.column
49 coreutils
50 gnugrep
51 gnused
52 jq
53 lldap # Needed for lldap_set_password
54 curl
55 ]
56 }
57 '';
58
59 passthru.updateScript = unstableGitUpdater { };
60
61 meta = {
62 description = "Command line tool for managing LLDAP";
63 longDescription = ''
64 LDAP-CLI is a command line interface for LLDAP.
65
66 LLDAP uses GraphQL to offer an HTTP-based API.
67 This API is used by an included web-based user interface.
68 Unfortunately, LLDAP lacks a command-line interface,
69 which is a necessity for any serious administrator.
70 LLDAP-CLI translates CLI commands to GraphQL API calls.
71 '';
72 homepage = "https://github.com/Zepmann/lldap-cli";
73 license = lib.licenses.gpl3Only;
74 maintainers = [ lib.maintainers.nw ];
75 mainProgram = "lldap-cli";
76 platforms = lib.platforms.unix;
77 };
78}