3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #265818 from K900/vaultwarden-1.30.0

Vaultwarden 1.30.0
This commit is contained in:
K900 2023-11-07 20:00:18 +03:00 committed by GitHub
commit 68b237a102
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 610 additions and 388 deletions

View file

@ -54,9 +54,8 @@ let
services.postgresql = {
enable = true;
initialScript = pkgs.writeText "postgresql-init.sql" ''
CREATE DATABASE bitwarden;
CREATE USER bitwardenuser WITH PASSWORD '${dbPassword}';
GRANT ALL PRIVILEGES ON DATABASE bitwarden TO bitwardenuser;
CREATE DATABASE bitwarden WITH OWNER bitwardenuser;
'';
};

File diff suppressed because it is too large Load diff

View file

@ -9,13 +9,13 @@ in
rustPlatform.buildRustPackage rec {
pname = "vaultwarden";
version = "1.29.2";
version = "1.30.0";
src = fetchFromGitHub {
owner = "dani-garcia";
repo = pname;
rev = version;
hash = "sha256-ByMPS68GBOvjB/RpoLAvgE+NcbbIa1qfU1TQ4yhbH+I=";
hash = "sha256-mBKedJvb67FR4e8ZzdL8umg9XTgch1OWhbR1k46Lkn4=";
};
cargoLock = {

View file

@ -1,4 +1,4 @@
{ writeShellScript
{ writeShellApplication
, lib
, nix
, nix-prefetch-git
@ -8,20 +8,23 @@
, gnugrep
, gnused
, jq
, yq
}:
writeShellScript "update-vaultwarden" ''
PATH=${lib.makeBinPath [ curl git gnugrep gnused jq nix nix-prefetch-git nix-update ]}
lib.getExe (writeShellApplication {
name = "update-vaultwarden";
runtimeInputs = [ curl git gnugrep gnused jq yq nix nix-prefetch-git nix-update ];
set -euxo pipefail
text = ''
VAULTWARDEN_VERSION=$(curl --silent https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest | jq -r '.tag_name')
nix-update "vaultwarden" --version "$VAULTWARDEN_VERSION"
VAULTWARDEN_VERSION=$(curl --silent https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest | jq -r '.tag_name')
nix-update "vaultwarden" --version "$VAULTWARDEN_VERSION"
URL="https://raw.githubusercontent.com/dani-garcia/vaultwarden/''${VAULTWARDEN_VERSION}/docker/Dockerfile.j2"
WEBVAULT_VERSION=$(curl --silent "$URL" | grep "set vault_version" | sed -E "s/.*\"v([^\"]+)\".*/\\1/")
old_hash=$(nix --extra-experimental-features nix-command eval -f default.nix --raw vaultwarden.webvault.bw_web_builds.outputHash)
new_hash=$(nix --extra-experimental-features nix-command hash to-sri --type sha256 $(nix-prefetch-git https://github.com/dani-garcia/bw_web_builds.git --rev "v$WEBVAULT_VERSION" | jq --raw-output ".sha256"))
sed -e "s#$old_hash#$new_hash#" -i pkgs/tools/security/vaultwarden/webvault.nix
nix-update "vaultwarden.webvault" --version "$WEBVAULT_VERSION"
''
URL="https://raw.githubusercontent.com/dani-garcia/vaultwarden/''${VAULTWARDEN_VERSION}/docker/DockerSettings.yaml"
WEBVAULT_VERSION="$(curl --silent "$URL" | yq -r ".vault_version" | sed s/^v//)"
old_hash="$(nix --extra-experimental-features nix-command eval -f default.nix --raw vaultwarden.webvault.bw_web_builds.outputHash)"
new_hash="$(nix-prefetch-git https://github.com/dani-garcia/bw_web_builds.git --rev "v$WEBVAULT_VERSION" | jq --raw-output ".sha256")"
new_hash_sri="$(nix --extra-experimental-features nix-command hash to-sri --type sha256 "$new_hash")"
sed -e "s#$old_hash#$new_hash_sri#" -i pkgs/tools/security/vaultwarden/webvault.nix
nix-update "vaultwarden.webvault" --version "$WEBVAULT_VERSION"
'';
})

View file

@ -7,13 +7,13 @@
}:
let
version = "2023.7.1";
version = "2023.10.0";
bw_web_builds = fetchFromGitHub {
owner = "dani-garcia";
repo = "bw_web_builds";
rev = "v${version}";
hash = "sha256-B7FGLKuwxldlHnIIzQbDjZT9cs5+lixo/fBtlexNLQc=";
hash = "sha256-5vfmMJIGKyZlTQDi/t1YKAALbW/6BFAcWODfkypk/eA=";
};
in buildNpmPackage rec {
pname = "vaultwarden-webvault";
@ -23,10 +23,10 @@ in buildNpmPackage rec {
owner = "bitwarden";
repo = "clients";
rev = "web-v${lib.removeSuffix "b" version}";
hash = "sha256-HEEUboaIY/Zi/wUhp9y7oIOuQl6csjo97eygTLPNfNo=";
hash = "sha256-egXToXWfb9XV7JuCRBYJO4p/e+WOwMncPKz0oBgeALQ=";
};
npmDepsHash = "sha256-8Epkvjzllt//kdrKT4jUDOhj47Fnb0qSFU1qJthL2Mo=";
npmDepsHash = "sha256-iO8ZozVl1vOOqowQARnRJWSFUFnau46+dKfcMSkyU3o=";
postPatch = ''
ln -s ${bw_web_builds}/{patches,resources} ..