fa5436e0a7
GitOrigin-RevId: e8057b67ebf307f01bdcc8fba94d94f75039d1f6
75 lines
1.7 KiB
Nix
75 lines
1.7 KiB
Nix
{ lib
|
|
, buildNpmPackage
|
|
, fetchFromGitHub
|
|
, git
|
|
, nixosTests
|
|
, python3
|
|
, vaultwarden
|
|
}:
|
|
|
|
let
|
|
version = "2024.5.0";
|
|
|
|
bw_web_builds = fetchFromGitHub {
|
|
owner = "dani-garcia";
|
|
repo = "bw_web_builds";
|
|
rev = "v${version}";
|
|
hash = "sha256-di0oOM3ju3rkDVGmKpvS6sCaIXL/QGawr0TUrQjZ8dM=";
|
|
};
|
|
|
|
in buildNpmPackage rec {
|
|
pname = "vaultwarden-webvault";
|
|
inherit version;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "bitwarden";
|
|
repo = "clients";
|
|
rev = "web-v${lib.removeSuffix "b" version}";
|
|
hash = "sha256-kQ2tWfkkG5aifA8UGb5X1wQkGZr6dcVlrb+b78RFX/k=";
|
|
};
|
|
|
|
npmDepsHash = "sha256-gprJGOE/uSSM3NHpcbelB7sueObEl4o522WRHIRFmwo=";
|
|
|
|
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"
|
|
];
|
|
|
|
npmFlags = [ "--legacy-peer-deps" ];
|
|
|
|
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";
|
|
changelog = "https://github.com/dani-garcia/bw_web_builds/releases/tag/v${version}";
|
|
platforms = platforms.all;
|
|
license = licenses.gpl3Plus;
|
|
inherit (vaultwarden.meta) maintainers;
|
|
};
|
|
}
|