Flakes and remote repos not being updated

Hi!

I added a flakes.nix file to my project to ease distribution, published it on GitHub, but when I run nix shell github:rapenne-s/bento, I always get the first version fetched. If I update the code on GitHub meanwhile, the nix shell command is instantaneous and still using the same version as the first time.

I don’t really understand why I get this behavior, and how to fix it. :frowning:

1 Like

Nix caches such downloads for a fixed length of time. You can run a command with --tarball-ttl 0 or you can blow away ~/.cache/nix/.

1 Like

Cool! I cleaned the cache and it worked.

Do you know where this is documented? I can’t find cache related information in the man pages :frowning:

The only place I know it’s (partially) documented is in man nix.conf under tarball-ttl.

the default value is 4294967295 this seems super wrong to me, it’s 136 years. I understand flakes downloaded remotely are never updated !?

That can’t be right…

After a bit of searching, I think it’s actually 1 hour. The documentation must just be wrong:

that number looks suspiciously like the maximum of an integer

Meanwhile, i’m making a PR to add --tarball-ttl to flakes command man page

It is mentioned briefly in man nix.

yes, but I don’t see why one would go to read man.nix to look for parameters to nix shell ?

A lot of those options apply to all nix commands, since they override nix.conf settings. Though that’s just another of those things you “just have to know”…

oh, that’s particularly helpful to know!! :star_struck:

But yeah, this is absolutely not obvious behavior :sweat_smile: @fricklerhandwerk :wave:t3: do you have an idea where this can be documented?

2 Likes

There is PR to address this discrepancy: https://github.com/NixOS/nix/pull/6854

1 Like

Intuitively I would also say common options should be documented for each command that shares them, and indeed that’s what we already have in principle: nix shell

Agree with @tejing that „you just have to know“ does not scale.

One could probably make another category for common flags, and possibly that would require some new logic if it doesn’t nicely map to what’s there already.

I recently refactored the rendering part, which should now hopefully make the idea behind how that stuff is presented a bit easier to grok.

1 Like

See some related discussion here: nix commands shouldn't cache remote git refs · Issue #6830 · NixOS/nix · GitHub