Created
July 11, 2017 15:29
-
-
Save nc6/1ebd75ddfef4196794510036078acb0c to your computer and use it in GitHub Desktop.
Script to update nixpkgs derivation for sublime3-dev builds.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env nix-shell | |
#! nix-shell -i bash -p go-pup | |
WD="${1:-$HOME/nixpkgs}" | |
NIXEXPR="$WD/pkgs/applications/editors/sublime3-dev/default.nix" | |
LATEST_BUILD=$( curl -s http://www.sublimetext.com/3dev \ | |
| pup "h2" | grep Build | cut -d" " -f 3 | sort -rn | head -n 1) | |
SHA_32=$(curl -s "https://download.sublimetext.com/sublime_text_3_build_${LATEST_BUILD}_x32.tar.bz2" \ | |
| sha256sum | cut -d' ' -f1) | |
SHA_64=$(curl -s "https://download.sublimetext.com/sublime_text_3_build_${LATEST_BUILD}_x64.tar.bz2" \ | |
| sha256sum | cut -d' ' -f1) | |
echo $SHA_32 | |
echo $SHA_64 | |
sed -e "9s/build = \".*\";/build = \"$LATEST_BUILD\";/" \ | |
-e "23s/sha256 = \".*\";/sha256 = \"$SHA_32\";/" \ | |
-e "29s/sha256 = \".*\";/sha256 = \"$SHA_64\";/" \ | |
-i $NIXEXPR | |
cd $WD | |
git add $NIXEXPR | |
git commit --amend --no-edit | |
nix-env -f '<nixpkgs>' -iA all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment