nixos/applications/bitwarden/_bitwarden-directory-connector.nix

66 lines
1.5 KiB
Nix

{
lib,
buildNpmPackage,
fetchFromGitHub,
pkgs,
git,
python3,
pkg-config,
libsecret,
nodejs_18,
makeWrapper,
}: let
buildNpmPackage' = buildNpmPackage.override {nodejs = nodejs_18;};
in
buildNpmPackage' rec {
pname = "bitwarden-directory-connector";
version = "2023.10.0";
src = fetchFromGitHub {
owner = "bitwarden";
repo = "directory-connector";
rev = "v${version}";
hash = "sha256-CgaCnMWNVWCJBypNcdoseVCwD8Mlq4YaWpK+VZT/7Qk=";
leaveDotGit = true;
};
npmDepsHash = "sha256-jBAWWY12qeX2EDhUvT3TQpnQvYXRsIilRrXGpVzxYvw=";
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
makeCacheWritable = true;
npmBuildScript = "build:cli:prod";
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -R {build-cli,node_modules} $out
runHook postInstall
'';
# needs to be wrapped with nodejs so that it can be executed
postInstall = ''
chmod +x $out/build-cli/bwdc.js
makeWrapper $out/build-cli/bwdc.js $out/bin/${pname} --prefix PATH:"${lib.makeBinPath [nodejs_18]}"
'';
buildInputs = [
libsecret
];
nativeBuildInputs = [
git
python3
pkg-config
makeWrapper
];
meta = with lib; {
description = "A LDAP connector for Bitwarden";
homepage = "https://github.com/bitwarden/directory-connector";
license = licenses.gpl3Only;
maintainers = with maintainers; [Silver-Golden];
platforms = platforms.linux;
mainProgram = "${pname}";
};
}