Skip to content

Instantly share code, notes, and snippets.

@grahamhelton
Created January 21, 2024 04:41
Show Gist options
  • Save grahamhelton/ce5ef83cac3ba67bfd529e302dda250b to your computer and use it in GitHub Desktop.
Save grahamhelton/ce5ef83cac3ba67bfd529e302dda250b to your computer and use it in GitHub Desktop.
Grabs the sha1sum of a remote github repo and then prints the nixos configuration to download it on rebuild
if [ $# -ne 2 ]
then
echo "Usage: getsha1 <github_url> <path_to_store_file>
IE: getsha1 https://github.com/danielmiessler/SecLists Documents/wordlists/seclists"
exit
fi
github="$1"
sha1=$(git ls-remote $1 | awk '{print $1}' | head -n 1)
echo "
home.file = {
\"$2\".source = builtins.fetchGit {
url = \"$1\";
rev = \"$sha1\";
};
};
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment