Closed michaelpj closed 3 years ago
To be clear, what I'm suggesting is just not including the revision in the folder name (if that's what's happening), or making it part of the parent folder or something.
For bonus points, people are most likely to have checked out the repo foo/bar
as bar
on their local machines, so having it in a folder called bar
is most likely to end up getting cache hits if they've made this mistake.
I will be retrieving the bonus points when version 0.8 is released ;)
Has been released for a while but is now also in the stable branch.
I noticed that I was getting far fewer cache hits than I'd expect on Hercules.
It turns out that you really want to set
name
if you're using one of e.g. the nixpkgscleanSource
functions, otherwise you can end up with the name of the current folder in the parent directory: https://github.com/NixOS/nixpkgs/blob/master/lib/sources.nix#L65Now, this is bad enough as it is, and probably enough to mess up sharing your cache between Hercules and your local machine. But it gets worse: the sources I see from hercules have names like this:
/nix/store/nlhnmg58c8q569ndh0bmdqn5667i1kbg-input-output-hk-plutus-e12feab--language-plutus-core--language-plutus-core
I think what this means is that Hercules is checking out my source into a folder that includes the name of the current revision in it... which means that we are guaranteed a cache miss for everything that depends on the source on every commit :scream:
(I'm slightly guessing here, but I can't see where else that bit of sha would come from.)
Now, users should just Not Do That, but it's very easy to do, and I think Hercules could mitigate this significantly.