[skip ci] feat: some more changes based on https://github.com/NixOS/nixpkgs/pull/265783

This commit is contained in:
silver 2023-12-30 10:38:31 +00:00
parent a19d1cc915
commit 5900c41ab7
3 changed files with 54 additions and 57 deletions

View file

@ -7,61 +7,60 @@
pkg-config,
libsecret,
nodejs_18,
}: let
buildNpmPackage' = buildNpmPackage.override {nodejs = nodejs_18;};
in
buildNpmPackage' rec {
pname = "bitwarden-directory-connector";
version = "2023.10.0";
}:
buildNpmPackage rec {
pname = "bitwarden-directory-connector-cli";
version = "2023.10.0";
nodejs = nodejs_18;
src = fetchFromGitHub {
owner = "bitwarden";
repo = "directory-connector";
rev = "v${version}";
hash = "sha256-PlOtTh+rpTxAv8ajHBDHZuL7yeeLVpbAfKEDPQlejIg=";
};
src = fetchFromGitHub {
owner = "bitwarden";
repo = "directory-connector";
rev = "v${version}";
hash = "sha256-PlOtTh+rpTxAv8ajHBDHZuL7yeeLVpbAfKEDPQlejIg=";
};
postPatch = ''
${lib.getExe jq} 'del(.scripts.preinstall)' package.json > package.json.tmp
mv -f package.json{.tmp,}
'';
postPatch = ''
${lib.getExe jq} 'del(.scripts.preinstall)' package.json > package.json.tmp
mv -f package.json{.tmp,}
'';
npmDepsHash = "sha256-jBAWWY12qeX2EDhUvT3TQpnQvYXRsIilRrXGpVzxYvw=";
npmDepsHash = "sha256-jBAWWY12qeX2EDhUvT3TQpnQvYXRsIilRrXGpVzxYvw=";
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
makeCacheWritable = true;
npmBuildScript = "build:cli:prod";
makeCacheWritable = true;
npmBuildScript = "build:cli:prod";
installPhase = ''
runHook preInstall
mkdir -p $out/libexec/bitwarden-directory-connector
cp -R {build-cli,node_modules} $out/libexec/bitwarden-directory-connector
runHook postInstall
'';
installPhase = ''
runHook preInstall
mkdir -p $out/libexec/bitwarden-directory-connector
cp -R {build-cli,node_modules} $out/libexec/bitwarden-directory-connector
runHook postInstall
'';
# 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
'';
# 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
'';
buildInputs = [
libsecret
];
buildInputs = [
libsecret
];
nativeBuildInputs = [
python3
pkg-config
];
nativeBuildInputs = [
python3
pkg-config
];
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";
};
}
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";
};
}

View file

@ -5,12 +5,12 @@
...
}:
with lib; let
cfg = config.services.bitwarden-directory-connector;
cfg = config.services.bitwarden-directory-connector-cli;
in {
options.services.bitwarden-directory-connector = {
options.services.bitwarden-directory-connector-cli = {
enable = mkEnableOption "Bitwarden Directory Connector";
package = mkPackageOption pkgs "bitwarden-directory-connector" {};
package = mkPackageOption pkgs "bitwarden-directory-connector-cli" {};
domain = mkOption {
type = types.str;
@ -36,7 +36,6 @@ in {
If you used the desktop application to test the configuration you can find the settings by searching for `ldap` in `~/.config/Bitwarden\ Directory\ Connector/data.json`.
'';
default = {};
type = types.submodule ({
config,
options,
@ -110,7 +109,6 @@ in {
If you used the desktop application to test the configuration you can find the settings by searching for `sync` in `~/.config/Bitwarden\ Directory\ Connector/data.json`.
'';
default = {};
type = types.submodule ({
config,
options,
@ -259,18 +257,18 @@ in {
};
systemd = {
timers.bitwarden-directory-connector = {
timers.bitwarden-directory-connector-cli = {
description = "Sync timer for Bitwarden Directory Connector";
wantedBy = ["timers.target"];
after = ["network-online.target"];
timerConfig = {
OnCalendar = cfg.interval;
Unit = "bitwarden-directory-connector.service";
Unit = "bitwarden-directory-connector-cli.service";
Persistent = true;
};
};
services.bitwarden-directory-connector = {
services.bitwarden-directory-connector-cli = {
description = "Main process for Bitwarden Directory Connector";
path = [pkgs.jq];

View file

@ -29,7 +29,7 @@ in {
group = user;
};
services.bitwarden-directory-connector = {
services.bitwarden-directory-connector-cli = {
enable = true;
user = user;