2023-02-22 10:55:15 +00:00
|
|
|
{ lib
|
|
|
|
, buildNpmPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, git
|
|
|
|
, nixosTests
|
|
|
|
, nodejs-16_x
|
|
|
|
, python3
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
buildNpmPackage' = buildNpmPackage.override { nodejs = nodejs-16_x; };
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
version = "2022.12.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
bw_web_builds = fetchFromGitHub {
|
|
|
|
owner = "dani-garcia";
|
|
|
|
repo = "bw_web_builds";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-4yUE0ySUCKmmbca+T8qjqSO0AHZEUAHZ4nheRjpDnZo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-02-22 10:55:15 +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";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
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
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
passthru = {
|
|
|
|
inherit bw_web_builds;
|
|
|
|
tests = nixosTests.vaultwarden;
|
|
|
|
};
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2021-07-04 02:40:35 +00:00
|
|
|
description = "Integrates the web vault into vaultwarden";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/dani-garcia/bw_web_builds";
|
|
|
|
platforms = platforms.all;
|
2021-02-13 14:23:35 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2023-02-22 10:55:15 +00:00
|
|
|
maintainers = with maintainers; [ dotlambda msteen mic92 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|