Created
January 21, 2024 04:41
-
-
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
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
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