nix icon indicating copy to clipboard operation
nix copied to clipboard

nix flakes is too aggressive with caching when using things like `nix run github:...`

Open colemickens opened this issue 5 years ago • 7 comments

Describe the bug

I need to be able to tell users that they can run the listed command.

But I really can't have much faith in which version they're getting because of the type of caching that's going on. I'm making fixes, pushing, and the command just spits out the same error. I don't see an intuitive way to bust the cast. I think it ought to be checking much more aggressively when given external references like github:.

# install nix from nixos.org/download
nix-env -iA nixpkgs.nixUnstable
nix build \
  --experimental-features 'nix-command flakes' \
  'github:colemickens/nixcfg#hosts.testipfsvm'

Expected behavior

A clear and concise description of what you expected to happen.

nix-env --version output nix-env (Nix) 3.0pre20200829_f156513 nix (Nix) 3.0pre20200829_f156513

Additional context

Add any other context about the problem here.

colemickens avatar Sep 13 '20 00:09 colemickens

as a workaround, add /<commit_id> to the github URL. Eg: github:colemickens/nixcfg/a00c2b2e40f8c0a483883370c44fb45c7802ca20#hosts.testipfsvm

zimbatm avatar Sep 13 '20 08:09 zimbatm

You can pass --refresh to force a redownload.

edolstra avatar Sep 14 '20 12:09 edolstra

I marked this as stale due to inactivity. → More info

stale[bot] avatar Mar 16 '21 03:03 stale[bot]

I closed this issue due to inactivity. → More info

stale[bot] avatar Apr 19 '22 04:04 stale[bot]

We probably want to check the current git commit for all the git sources (github, git+https, git+ssh, git+file), right?

elikoga avatar Sep 08 '23 09:09 elikoga

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/deployment-tools-evaluating-nixops-deploy-rs-and-vanilla-nix-rebuild/36388/27

nixos-discourse avatar Jan 02 '24 00:01 nixos-discourse

You can pass --refresh to force a redownload.

Is there any equivalent for that on nixos-rebuild? Even if I add --refresh, nix doesn't seem to notice that the repo I'm importing in my flake changed so it just rebuilds from cache

LuNeder avatar May 25 '24 18:05 LuNeder

@LuNeder maybe the following will help: --option eval-cache false

dasj19 avatar Sep 01 '24 14:09 dasj19