Skip to content

Instantly share code, notes, and snippets.

@mkohler
Created June 24, 2022 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkohler/ca61111515f70b0575d66d7f51b4d6c6 to your computer and use it in GitHub Desktop.
Save mkohler/ca61111515f70b0575d66d7f51b4d6c6 to your computer and use it in GitHub Desktop.
Create a github archive link for the current version of nixpkgs
#!/bin/sh
# Get the current version, and then use tr to remove double-quotes.
version=$(nix-instantiate --eval --attr 'lib.version' '<nixpkgs>' | tr -d '"')
# The version is in the form YY.MM.NUM.HASH. We just want the 4th field.
commit_hash=$(echo ${version} | cut -d '.' -f4)
echo "https://github.com/NixOS/nixpkgs/archive/${commit_hash}.tar.gz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment