mirror of
https://github.com/Mic92/sops-nix.git
synced 2025-12-26 14:14:58 +08:00
add scripts to update vendorHash
This commit is contained in:
parent
62a7c95c8c
commit
3c851dbbea
2 changed files with 45 additions and 0 deletions
17
scripts/update-vendor-hash.sh
Executable file
17
scripts/update-vendor-hash.sh
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p nix -p coreutils -p gnused -p gawk
|
||||
|
||||
set -exuo pipefail
|
||||
|
||||
failedbuild=$(nix build --impure --expr '(with import <nixpkgs> {}; pkgs.callPackage ./. { vendorHash = ""; }).sops-install-secrets' 2>&1 || true)
|
||||
echo "$failedbuild"
|
||||
checksum=$(echo "$failedbuild" | awk '/got:.*sha256/ { print $2 }')
|
||||
sed -i -e "s|vendorHash ? \".*\"|vendorHash ? \"$checksum\"|" default.nix
|
||||
|
||||
# git push if we have a diff
|
||||
if [[ -n $(git diff) ]]; then
|
||||
git add default.nix
|
||||
git commit -m "sops-install-secrets: update checksum to $checksum"
|
||||
git push
|
||||
fi
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue