14 common = { name, npmBuildScript, installPhase }: buildNpmPackage rec {
19 src = fetchFromGitHub {
21 repo = "directory-connector";
23 hash = "sha256-Vop5Y1prdjA5SOQsA1HNBr3IBhe9Ya8d8M6CsS9xohg=";
27 ${lib.getExe buildPackages.jq} 'del(.scripts.preinstall)' package.json > package.json.tmp
28 mv -f package.json{.tmp,}
30 substituteInPlace electron-builder.json \
31 --replace-fail '"afterSign": "scripts/notarize.js",' "" \
32 --replace-fail "AppImage" "dir"
35 npmDepsHash = "sha256-8rmZSl5K2l97QHaNtcfW202TtcEa3HIjEjO/AkaZkdQ=";
37 env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
39 makeCacheWritable = true;
40 inherit npmBuildScript installPhase;
47 (python3.withPackages (ps: with ps; [ setuptools ]))
52 description = "LDAP connector for Bitwarden";
53 homepage = "https://github.com/bitwarden/directory-connector";
54 license = licenses.gpl3Only;
55 maintainers = with maintainers; [ Silver-Golden SuperSandro2000 ];
56 platforms = platforms.linux;
61 bitwarden-directory-connector = common {
62 name = "bitwarden-directory-connector";
63 npmBuildScript = "build:dist";
67 npm exec electron-builder -- \
69 -c.electronDist=${electron.dist} \
70 -c.electronVersion=${electron.version} \
73 mkdir -p $out/share/bitwarden-directory-connector $out/bin
74 cp -r dist/*-unpacked/{locales,resources{,.pak}} $out/share/bitwarden-directory-connector
76 makeWrapper ${lib.getExe electron} $out/bin/bitwarden-directory-connector \
77 --add-flags $out/share/bitwarden-directory-connector/resources/app.asar \
78 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
79 --set-default ELECTRON_IS_DEV 0 \
86 bitwarden-directory-connector-cli = common {
87 name = "bitwarden-directory-connector-cli";
88 npmBuildScript = "build:cli:prod";
92 mkdir -p $out/libexec/bitwarden-directory-connector
93 cp -R build-cli node_modules $out/libexec/bitwarden-directory-connector
95 # needs to be wrapped with nodejs so that it can be executed
96 chmod +x $out/libexec/bitwarden-directory-connector/build-cli/bwdc.js
98 ln -s $out/libexec/bitwarden-directory-connector/build-cli/bwdc.js $out/bin/bitwarden-directory-connector-cli