nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 jdk,
6 makeWrapper,
7 autoPatchelfHook,
8 makeDesktopItem,
9 glib,
10 libsecret,
11 webkitgtk_4_1,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "apache-directory-studio";
16 version = "2.0.0-M17";
17 versionWithDate = "2.0.0.v20210717-M17";
18
19 src =
20 if stdenv.hostPlatform.system == "x86_64-linux" then
21 fetchurl {
22 url = "mirror://apache/directory/studio/${versionWithDate}/ApacheDirectoryStudio-${versionWithDate}-linux.gtk.x86_64.tar.gz";
23 sha256 = "19zdspzv4n3mfgb1g45s3wh0vbvn6a9zjd4xi5x2afmdjkzlwxi4";
24 }
25 else
26 throw "Unsupported system: ${stdenv.hostPlatform.system}";
27
28 desktopItem = makeDesktopItem {
29 name = "apache-directory-studio";
30 exec = "ApacheDirectoryStudio";
31 icon = "apache-directory-studio";
32 comment = "Eclipse-based LDAP browser and directory client";
33 desktopName = "Apache Directory Studio";
34 genericName = "Apache Directory Studio";
35 categories = [
36 "Java"
37 "Network"
38 ];
39 };
40
41 buildInputs = [
42 glib
43 libsecret
44 ];
45 nativeBuildInputs = [
46 makeWrapper
47 autoPatchelfHook
48 ];
49
50 installPhase = ''
51 dest="$out/libexec/ApacheDirectoryStudio"
52 mkdir -p "$dest"
53 cp -r . "$dest"
54
55 mkdir -p "$out/bin"
56 patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
57 "$dest/ApacheDirectoryStudio"
58
59 # About `/tmp/SWT-GDBusServer`, see
60 # https://github.com/adoptium/adoptium-support/issues/785#issuecomment-1866680133
61 # and
62 # https://github.com/adoptium/adoptium-support/issues/785#issuecomment-2387481967.
63 makeWrapper "$dest/ApacheDirectoryStudio" \
64 "$out/bin/ApacheDirectoryStudio" \
65 --prefix PATH : "${jdk}/bin" \
66 --prefix LD_LIBRARY_PATH : ${
67 lib.makeLibraryPath [
68 glib
69 webkitgtk_4_1
70 ]
71 } \
72 --run "mkdir -p /tmp/SWT-GDBusServer"
73 install -D icon.xpm "$out/share/pixmaps/apache-directory-studio.xpm"
74 install -D -t "$out/share/applications" ${desktopItem}/share/applications/*
75 '';
76
77 meta = {
78 description = "Eclipse-based LDAP browser and directory client";
79 homepage = "https://directory.apache.org/studio/";
80 sourceProvenance = with lib.sourceTypes; [
81 binaryBytecode
82 binaryNativeCode
83 ];
84 license = lib.licenses.asl20;
85 # Upstream supports macOS and Windows too.
86 platforms = lib.platforms.linux;
87 maintainers = [ lib.maintainers.bjornfor ];
88 mainProgram = "ApacheDirectoryStudio";
89 };
90}