Created
March 15, 2022 14:50
-
-
Save tomberek/eb6c19b1b28ee8becc0d602e7428f2fd to your computer and use it in GitHub Desktop.
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
default = { | |
type = "app"; | |
program = with args.unstable.legacyPackages.x86_64-linux; | |
(writeShellApplication { | |
name = "hash-me.sh"; | |
runtimeInputs = [coreutils]; | |
text = '' | |
self=$(echo ${self.outPath} | cut -d/ -f4) | |
rev=${builtins.toString (self.revCount or 0)} | |
lastMod=${builtins.toString (self.lastModified or 0)} | |
echo "$self" >&2 | |
hash=$(printf "%s;%s;%d;%d;%s" "$self" "" "$rev" "$lastMod" "$(cat ${self.outPath}/flake.lock)" | sha256sum | cut -d' ' -f1) | |
printf "$HOME/.cache/nix/eval-cache-v2/%s.sqlite\n" "$hash" | |
''; | |
}) | |
+ "/bin/hash-me.sh"; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment