nixpkgs/pkgs/tools/security/vaultwarden/webvault.nix
Martin Weinelt 5dbd09e0fa
vaultwarden.webvault: Use default nodejs version
NodeJS 16 is going EOL soon, so let's get back onto the default version,
which is at 18 right now.
2023-05-06 16:02:08 +02:00

71 lines
1.5 KiB
Nix

{ lib
, buildNpmPackage
, fetchFromGitHub
, git
, nixosTests
, python3
}:
let
version = "2023.3.0b";
bw_web_builds = fetchFromGitHub {
owner = "dani-garcia";
repo = "bw_web_builds";
rev = "v${version}";
hash = "sha256-3kCgT+NsYU7sRJvw56vcPXS7j+eHxgek195zZnamjJw=";
};
in buildNpmPackage rec {
pname = "vaultwarden-webvault";
inherit version;
src = fetchFromGitHub {
owner = "bitwarden";
repo = "clients";
rev = "web-v${lib.removeSuffix "b" version}";
hash = "sha256-pSaFksfdxVx7vaozR5h+wpPB42qVgs+aXhV7HGFq71E=";
};
npmDepsHash = "sha256-ZHbKq7EseYNTWjKi+W66WinmReZbpn3kJB3g0N2z4ww=";
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 ];
};
}