2024-05-07 03:23:55 -04:00
|
|
|
watch_file flake.in.nix
|
2024-07-28 21:52:06 -04:00
|
|
|
|
|
|
|
# Calculate the hash of flake.in.nix
|
|
|
|
current_hash=$(md5sum flake.in.nix | cut -d ' ' -f 1)
|
|
|
|
stored_hash_file=".flake_in_nix_hash"
|
|
|
|
|
|
|
|
# Read the stored hash if it exists
|
|
|
|
if [ -f "$stored_hash_file" ]; then
|
|
|
|
stored_hash=$(cat "$stored_hash_file")
|
|
|
|
else
|
|
|
|
stored_hash=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Compare the hashes and copy if they are different
|
|
|
|
if [ "$current_hash" != "$stored_hash" ]; then
|
|
|
|
cp $(nix eval --raw .#nextFlake) flake.nix
|
|
|
|
# Store the new hash
|
|
|
|
echo "$current_hash" > "$stored_hash_file"
|
|
|
|
fi
|
|
|
|
|
2024-05-07 03:23:55 -04:00
|
|
|
use_flake
|
2024-07-28 21:52:06 -04:00
|
|
|
|