Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gotify: adapt update script to use vendor sha #87849

Merged
merged 1 commit into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/servers/gotify/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ buildGoModule rec {
sha256 = import ./source-sha.nix;
};

vendorSha256 = "1ha0zgz1n07sd3if6823fi83j7yajysjdzfbwqk9rpsi6zv3cfh3";
vendorSha256 = import ./vendor-sha.nix;

postPatch = ''
substituteInPlace app.go \
Expand Down
12 changes: 6 additions & 6 deletions pkgs/servers/gotify/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ echo got version $version
echo \""${version#v}"\" > "$dirname/version.nix"
printf '%s' $(nix-prefetch-git --quiet --rev ${version} https://github.com/gotify/server | jq .sha256) > $dirname/source-sha.nix
tput setaf 1
echo zeroing modSha256 in $dirname/mod-sha.nix
echo zeroing vendorSha256 in $dirname/vendor-sha.nix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, you can also use nix-prefetch or nix-update itself for tasks like this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saves a few lines of code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean with the --fetcher argument?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You just need to pass a nix function as string to nix-prefetch: https://github.com/Mic92/nix-update/blob/master/nix_update/update.py#L37

tput sgr0
printf '"%s"' "0000000000000000000000000000000000000000000000000000" > $dirname/mod-sha.nix
printf '"%s"' "0000000000000000000000000000000000000000000000000000" > $dirname/vendor-sha.nix

GOTIFY_WEB_SRC="https://raw.githubusercontent.com/gotify/server/$version"

Expand All @@ -28,13 +28,13 @@ echo removed yarn.lock

echo running nix-build for ui
nix-build -A gotify-server.ui
echo running nix-build for gotify itself in order to get modSha256
echo running nix-build for gotify itself in order to get vendorSha256
set +e
modSha256="$(nix-build -A gotify-server 2>&1 | grep "got:" | cut -d':' -f3)"
vendorSha256="$(nix-build -A gotify-server 2>&1 | grep "got:" | cut -d':' -f3)"
set -e
printf '"%s"' "$modSha256" > $dirname/mod-sha.nix
printf '"%s"' "$vendorSha256" > $dirname/vendor-sha.nix
tput setaf 2
echo got modSha256 of: $modSha256
echo got vendorSha256 of: $vendorSha256
tput sgr0
echo running nix-build -A gotify-server which should build gotify-server normally
nix-build -A gotify-server
1 change: 1 addition & 0 deletions pkgs/servers/gotify/vendor-sha.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"1ha0zgz1n07sd3if6823fi83j7yajysjdzfbwqk9rpsi6zv3cfh3"