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