2023-02-16 05:02:50 +01:00
|
|
|
{ lib
|
|
|
|
, buildNpmPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, git
|
|
|
|
, nixosTests
|
|
|
|
, python3
|
2024-03-04 13:20:26 +01:00
|
|
|
, vaultwarden
|
2023-02-16 05:02:50 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2024-02-11 23:42:43 +01:00
|
|
|
version = "2024.1.2b";
|
2019-04-23 21:25:46 +02:00
|
|
|
|
2023-02-16 05:02:50 +01:00
|
|
|
bw_web_builds = fetchFromGitHub {
|
|
|
|
owner = "dani-garcia";
|
|
|
|
repo = "bw_web_builds";
|
|
|
|
rev = "v${version}";
|
2024-02-11 23:42:43 +01:00
|
|
|
hash = "sha256-p5UsI8T2cV5uQnQmOi5WBo2UirLLS83NHoaljxcRkqo=";
|
2019-04-23 21:25:46 +02:00
|
|
|
};
|
2024-01-17 00:56:28 +01:00
|
|
|
|
2023-05-06 16:02:08 +02:00
|
|
|
in buildNpmPackage rec {
|
2023-02-16 05:02:50 +01:00
|
|
|
pname = "vaultwarden-webvault";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bitwarden";
|
|
|
|
repo = "clients";
|
2023-03-28 04:44:49 +02:00
|
|
|
rev = "web-v${lib.removeSuffix "b" version}";
|
2024-01-30 13:31:00 +01:00
|
|
|
hash = "sha256-hzAkVzaCjwoZ/PMnsnSmsqUBWLhqfPWuWVujChy0V38=";
|
2023-02-16 05:02:50 +01:00
|
|
|
};
|
|
|
|
|
2024-01-30 13:31:00 +01:00
|
|
|
npmDepsHash = "sha256-KTqPf8jy8cgGz0+1GssSzEfPVSSQlLenLPgHggNoGfc=";
|
2023-02-16 05:02:50 +01:00
|
|
|
|
|
|
|
postPatch = ''
|
2024-01-19 13:48:43 +01:00
|
|
|
ln -s ${bw_web_builds}/{patches,resources} ..
|
2023-03-28 04:44:49 +02:00
|
|
|
PATH="${git}/bin:$PATH" VAULT_VERSION="${lib.removePrefix "web-" src.rev}" \
|
2023-02-16 05:02:50 +01:00
|
|
|
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 21:25:46 +02:00
|
|
|
|
2024-01-11 10:58:46 +01:00
|
|
|
npmFlags = [ "--legacy-peer-deps" ];
|
|
|
|
|
2023-02-16 05:02:50 +01:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/share/vaultwarden
|
|
|
|
mv apps/web/build $out/share/vaultwarden/vault
|
|
|
|
runHook postInstall
|
2019-04-23 21:25:46 +02:00
|
|
|
'';
|
|
|
|
|
2023-02-16 21:30:51 +01:00
|
|
|
passthru = {
|
|
|
|
inherit bw_web_builds;
|
|
|
|
tests = nixosTests.vaultwarden;
|
|
|
|
};
|
2020-06-06 12:55:50 +02:00
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2021-07-01 11:14:51 +02:00
|
|
|
description = "Integrates the web vault into vaultwarden";
|
2020-02-19 13:26:48 +01:00
|
|
|
homepage = "https://github.com/dani-garcia/bw_web_builds";
|
2024-01-19 13:48:43 +01:00
|
|
|
changelog = "https://github.com/dani-garcia/bw_web_builds/releases/tag/v${version}";
|
2019-04-23 21:25:46 +02:00
|
|
|
platforms = platforms.all;
|
2021-02-09 10:48:38 +01:00
|
|
|
license = licenses.gpl3Plus;
|
2024-03-02 20:10:16 +01:00
|
|
|
inherit (vaultwarden.meta) maintainers;
|
2019-04-23 21:25:46 +02:00
|
|
|
};
|
|
|
|
}
|