depot/third_party/nixpkgs/pkgs/tools/security/vaultwarden/webvault.nix
Default email 2c76a4cb41 Project import generated by Copybara.
GitOrigin-RevId: c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad
2023-11-16 04:20:00 +00:00

70 lines
1.5 KiB
Nix

{ lib
, buildNpmPackage
, fetchFromGitHub
, git
, nixosTests
, python3
}:
let
version = "2023.10.0";
bw_web_builds = fetchFromGitHub {
owner = "dani-garcia";
repo = "bw_web_builds";
rev = "v${version}";
hash = "sha256-5vfmMJIGKyZlTQDi/t1YKAALbW/6BFAcWODfkypk/eA=";
};
in buildNpmPackage rec {
pname = "vaultwarden-webvault";
inherit version;
src = fetchFromGitHub {
owner = "bitwarden";
repo = "clients";
rev = "web-v${lib.removeSuffix "b" version}";
hash = "sha256-egXToXWfb9XV7JuCRBYJO4p/e+WOwMncPKz0oBgeALQ=";
};
npmDepsHash = "sha256-iO8ZozVl1vOOqowQARnRJWSFUFnau46+dKfcMSkyU3o=";
postPatch = ''
ln -s ${bw_web_builds}/{patches,resources} ..
PATH="${git}/bin:$PATH" VAULT_VERSION="${lib.removePrefix "web-" src.rev}" \
bash ${bw_web_builds}/scripts/apply_patches.sh
'';
nativeBuildInputs = [
python3
];
makeCacheWritable = true;
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
npmBuildScript = "dist:oss:selfhost";
npmBuildFlags = [
"--workspace" "apps/web"
];
installPhase = ''
runHook preInstall
mkdir -p $out/share/vaultwarden
mv apps/web/build $out/share/vaultwarden/vault
runHook postInstall
'';
passthru = {
inherit bw_web_builds;
tests = nixosTests.vaultwarden;
};
meta = with lib; {
description = "Integrates the web vault into vaultwarden";
homepage = "https://github.com/dani-garcia/bw_web_builds";
platforms = platforms.all;
license = licenses.gpl3Plus;
maintainers = with maintainers; [ dotlambda msteen mic92 ];
};
}