a66bca1520
GitOrigin-RevId: 40f79f003b6377bd2f4ed4027dde1f8f922995dd
22 lines
686 B
Nix
22 lines
686 B
Nix
{ writeShellScript
|
|
, lib
|
|
, nix-update
|
|
, curl
|
|
, git
|
|
, gnugrep
|
|
, gnused
|
|
, jq
|
|
}:
|
|
|
|
writeShellScript "update-vaultwarden" ''
|
|
PATH=${lib.makeBinPath [ curl git gnugrep gnused jq nix-update ]}
|
|
|
|
set -euxo pipefail
|
|
|
|
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/.*\"([^\"]+)\".*/\\1/")
|
|
nix-update "vaultwarden.webvault" --version "$WEBVAULT_VERSION"
|
|
''
|