2023-02-16 04:02:50 +00:00
|
|
|
{ lib
|
|
|
|
, buildNpmPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, git
|
|
|
|
, nixosTests
|
|
|
|
, nodejs-16_x
|
|
|
|
, python3
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
buildNpmPackage' = buildNpmPackage.override { nodejs = nodejs-16_x; };
|
2019-04-23 19:25:46 +00:00
|
|
|
|
2022-12-24 16:51:51 +00:00
|
|
|
version = "2022.12.0";
|
2019-04-23 19:25:46 +00:00
|
|
|
|
2023-02-16 04:02:50 +00:00
|
|
|
bw_web_builds = fetchFromGitHub {
|
|
|
|
owner = "dani-garcia";
|
|
|
|
repo = "bw_web_builds";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-4yUE0ySUCKmmbca+T8qjqSO0AHZEUAHZ4nheRjpDnZo=";
|
2019-04-23 19:25:46 +00:00
|
|
|
};
|
2023-02-16 04:02:50 +00:00
|
|
|
in buildNpmPackage' {
|
|
|
|
pname = "vaultwarden-webvault";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bitwarden";
|
|
|
|
repo = "clients";
|
|
|
|
rev = "web-v${version}";
|
|
|
|
hash = "sha256-CsbnnP12P7JuGDOm5Ia73SzET/jCx3qRbz9vdUf7lCA=";
|
|
|
|
};
|
|
|
|
|
|
|
|
npmDepsHash = "sha256-wWOtVGNOzY2s82nfQDuWgA4ukpJxJr8Z7Y+rFPq2QdU=";
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
ln -s ${bw_web_builds}/{patches,resources} ..
|
|
|
|
PATH="${git}/bin:$PATH" VAULT_VERSION=${bw_web_builds.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"
|
|
|
|
];
|
2019-04-23 19:25:46 +00:00
|
|
|
|
2023-02-16 04:02:50 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/share/vaultwarden
|
|
|
|
mv apps/web/build $out/share/vaultwarden/vault
|
|
|
|
runHook postInstall
|
2019-04-23 19:25:46 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-16 20:30:51 +00:00
|
|
|
passthru = {
|
|
|
|
inherit bw_web_builds;
|
|
|
|
tests = nixosTests.vaultwarden;
|
|
|
|
};
|
2020-06-06 10:55:50 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2021-07-01 09:14:51 +00:00
|
|
|
description = "Integrates the web vault into vaultwarden";
|
2020-02-19 12:26:48 +00:00
|
|
|
homepage = "https://github.com/dani-garcia/bw_web_builds";
|
2019-04-23 19:25:46 +00:00
|
|
|
platforms = platforms.all;
|
2021-02-09 09:48:38 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2023-02-16 04:02:50 +00:00
|
|
|
maintainers = with maintainers; [ dotlambda msteen mic92 ];
|
2019-04-23 19:25:46 +00:00
|
|
|
};
|
|
|
|
}
|