blob: 041b7ae3154a5c1a50aa5bdb45eb5aea87a4ed45 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
{ lib
, buildNpmPackage
, fetchFromGitHub
, git
, nixosTests
, python3
, vaultwarden
}:
let
version = "2024.3.1";
bw_web_builds = fetchFromGitHub {
owner = "dani-garcia";
repo = "bw_web_builds";
rev = "v${version}";
hash = "sha256-oi0H8TIQwtpzxKoQGnKaOY0bcWu7avTtrY+NgNRiq8k=";
};
in buildNpmPackage rec {
pname = "vaultwarden-webvault";
inherit version;
src = fetchFromGitHub {
owner = "bitwarden";
repo = "clients";
rev = "web-v${lib.removeSuffix "b" version}";
hash = "sha256-JBEP4dNGL4rYKl2qNyhB2y/wZunikaGFltGVXLxgMWI=";
};
npmDepsHash = "sha256-vNudSHIMmF7oXGz+ZymQahyHebs/CBDc6Oy1g0A5nqA=";
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;
};
}
|