1{ lib, stdenvNoCC, fetchurl, makeWrapper, perlPackages }:
2
3stdenvNoCC.mkDerivation rec {
4 pname = "schema2ldif";
5 version = "1.3";
6
7 src = fetchurl {
8 url = "https://repos.fusiondirectory.org/sources/schema2ldif/schema2ldif-${version}.tar.gz";
9 hash = "sha256-KmXdqVuINUnJ6EF5oKgk6BsT3h5ebVqss7aCl3pPjQE=";
10 };
11
12 postPatch = ''
13 # Removes the root check and changes the temporary location
14 # from the nix store to $PWD
15 sed -i \
16 -e '/You have to run this script as root/d' \
17 -e 's|/\^(\.\*)\\\.schema\$/|/.*\\/(.*)\\.schema$/|g' \
18 bin/ldap-schema-manager
19 '';
20
21 buildInputs = [ perlPackages.perl ];
22 nativeBuildInputs = [ makeWrapper ];
23
24 installPhase = ''
25 mkdir -p $out/bin $out/share/man/man1
26
27 cp bin/{schema2ldif,ldap-schema-manager} $out/bin
28 gzip -c man/schema2ldif.1 > $out/share/man/man1/schema2ldif.1.gz
29 gzip -c man/ldap-schema-manager.1 > $out/share/man/man1/ldap-schema-manager.1.gz
30
31 wrapProgram $out/bin/schema2ldif \
32 --prefix PERL5PATH : "${perlPackages.makePerlPath [ perlPackages.GetoptLong ]}"
33 '';
34
35 meta = with lib; {
36 description = "Utilities to manage schema in .schema and .ldif format";
37 homepage = "https://www.fusiondirectory.org/schema2ldif-project-and-components/";
38 license = licenses.bsd3;
39 platforms = platforms.unix;
40 maintainers = with maintainers; [ das_j ];
41 };
42}