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-03-30 22:05:00 +00:00
|
|
|
version = "2023.3.0b";
|
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}";
|
2023-03-30 22:05:00 +00:00
|
|
|
hash = "sha256-3kCgT+NsYU7sRJvw56vcPXS7j+eHxgek195zZnamjJw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-03-30 22:05:00 +00:00
|
|
|
in buildNpmPackage' rec {
|
2023-02-22 10:55:15 +00:00
|
|
|
pname = "vaultwarden-webvault";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bitwarden";
|
|
|
|
repo = "clients";
|
2023-03-30 22:05:00 +00:00
|
|
|
rev = "web-v${lib.removeSuffix "b" version}";
|
|
|
|
hash = "sha256-pSaFksfdxVx7vaozR5h+wpPB42qVgs+aXhV7HGFq71E=";
|
2023-02-22 10:55:15 +00:00
|
|
|
};
|
|
|
|
|
2023-03-30 22:05:00 +00:00
|
|
|
npmDepsHash = "sha256-ZHbKq7EseYNTWjKi+W66WinmReZbpn3kJB3g0N2z4ww=";
|
2023-02-22 10:55:15 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
ln -s ${bw_web_builds}/{patches,resources} ..
|
2023-03-30 22:05:00 +00:00
|
|
|
PATH="${git}/bin:$PATH" VAULT_VERSION="${lib.removePrefix "web-" src.rev}" \
|
2023-02-22 10:55:15 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|