2023-02-22 10:55:15 +00:00
|
|
|
{ lib
|
|
|
|
, buildNpmPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, git
|
|
|
|
, nixosTests
|
2024-09-19 14:19:46 +00:00
|
|
|
, python3
|
2024-04-21 15:54:59 +00:00
|
|
|
, vaultwarden
|
2023-02-22 10:55:15 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "2024.6.2c";
|
|
|
|
|
|
|
|
suffix = lib.head (lib.match "[0-9.]*([a-z]*)" version);
|
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}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-Gd8yQx9j6ieUvaM6IPSELNRy83y0cBkBwLYMqk8OIjU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2024-01-25 14:12:00 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
in buildNpmPackage rec {
|
2023-02-22 10:55:15 +00:00
|
|
|
pname = "vaultwarden-webvault";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bitwarden";
|
|
|
|
repo = "clients";
|
2024-09-19 14:19:46 +00:00
|
|
|
rev = "web-v${lib.removeSuffix suffix version}";
|
|
|
|
hash = "sha256-HMQ0oQ04WkLlUgsYt6ZpcziDq05mnSA0+VnJCpteceg=";
|
2023-02-22 10:55:15 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
npmDepsHash = "sha256-zMzQEM5mV14gewzYhy1F2bNEugXjZSOviYwYVV2Cb8c=";
|
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 = [
|
2024-09-19 14:19:46 +00:00
|
|
|
(python3.withPackages (ps: [ ps.setuptools ]))
|
2023-02-22 10:55:15 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
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"
|
|
|
|
];
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
npmFlags = [ "--legacy-peer-deps" ];
|
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
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";
|
2024-01-25 14:12:00 +00:00
|
|
|
changelog = "https://github.com/dani-garcia/bw_web_builds/releases/tag/v${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.all;
|
2021-02-13 14:23:35 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2024-04-21 15:54:59 +00:00
|
|
|
inherit (vaultwarden.meta) maintainers;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|