2023-11-06 04:16:33 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildNpmPackage,
|
2023-11-06 05:18:52 +00:00
|
|
|
fetchFromGitHub,
|
2023-11-25 22:41:48 +00:00
|
|
|
jq,
|
2023-11-06 04:16:33 +00:00
|
|
|
python3,
|
|
|
|
pkg-config,
|
|
|
|
libsecret,
|
|
|
|
nodejs_18,
|
|
|
|
}: let
|
|
|
|
buildNpmPackage' = buildNpmPackage.override {nodejs = nodejs_18;};
|
|
|
|
in
|
|
|
|
buildNpmPackage' rec {
|
|
|
|
pname = "bitwarden-directory-connector";
|
2023-11-06 05:18:52 +00:00
|
|
|
version = "2023.10.0";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bitwarden";
|
|
|
|
repo = "directory-connector";
|
2023-11-12 03:27:30 +00:00
|
|
|
rev = "v${version}";
|
2023-11-25 22:41:48 +00:00
|
|
|
hash = "sha256-PlOtTh+rpTxAv8ajHBDHZuL7yeeLVpbAfKEDPQlejIg=";
|
2023-11-06 04:16:33 +00:00
|
|
|
};
|
|
|
|
|
2023-12-20 16:08:44 +00:00
|
|
|
postPatch = ''
|
2023-12-27 15:48:58 +00:00
|
|
|
${lib.getExe jq} 'del(.scripts.preinstall)' package.json > package.json.tmp
|
2023-11-25 22:41:48 +00:00
|
|
|
mv -f package.json{.tmp,}
|
|
|
|
'';
|
|
|
|
|
2023-11-06 04:16:33 +00:00
|
|
|
npmDepsHash = "sha256-jBAWWY12qeX2EDhUvT3TQpnQvYXRsIilRrXGpVzxYvw=";
|
|
|
|
|
|
|
|
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
|
|
|
|
|
|
|
makeCacheWritable = true;
|
|
|
|
npmBuildScript = "build:cli:prod";
|
|
|
|
|
|
|
|
installPhase = ''
|
2023-11-12 03:27:30 +00:00
|
|
|
runHook preInstall
|
2023-11-25 22:41:48 +00:00
|
|
|
mkdir -p $out/libexec/bitwarden-directory-connector
|
|
|
|
cp -R {build-cli,node_modules} $out/libexec/bitwarden-directory-connector
|
2023-11-12 03:27:30 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
# needs to be wrapped with nodejs so that it can be executed
|
|
|
|
postInstall = ''
|
2023-11-25 22:41:48 +00:00
|
|
|
chmod +x $out/libexec/bitwarden-directory-connector/build-cli/bwdc.js
|
|
|
|
mkdir -p $out/bin
|
|
|
|
ln -s $out/libexec/bitwarden-directory-connector/build-cli/bwdc.js $out/bin/bitwarden-directory-connector
|
2023-11-06 04:16:33 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libsecret
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
python3
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
2023-11-25 22:41:48 +00:00
|
|
|
description = "LDAP connector for Bitwarden";
|
2023-11-06 04:16:33 +00:00
|
|
|
homepage = "https://github.com/bitwarden/directory-connector";
|
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = with maintainers; [Silver-Golden];
|
2023-11-06 05:18:52 +00:00
|
|
|
platforms = platforms.linux;
|
2023-11-25 22:41:48 +00:00
|
|
|
mainProgram = "bitwarden-directory-connector";
|
2023-11-06 04:16:33 +00:00
|
|
|
};
|
|
|
|
}
|