But when I make a change to the repo and re-run the same command nothing happens.
I seems like the content for that repo is cached. Why is that? Is there a way around that?
In the long run it’s probably better to look into NixOps (or something) but I thought I start to learn the land like this first.
That’s the tarball-ttl nix setting, which can be set in /etc/nix/nix.conf, ~/.config/nix/nix.conf, or on the cmdline with --tarball-ttl. From man nix.conf:
The number of seconds a downloaded tarball is considered fresh. If the cached tarball is stale, Nix will check whether it is still up to date using the ETag header. Nix will download a new version if the ETag header is unsupported, or the cached ETag doesn’t match.
Setting the TTL to 0 forces Nix to always check if the tarball is up to date.
Nix caches tarballs in $XDG_CACHE_HOME/nix/tarballs.
Files fetched via NIX_PATH, fetchGit, fetchMercurial, fetchTarball, and fetchurl respect this TTL.
Unfortunately at least nixos-rebuild switch does not seem to have a --tarball-ttl command line parameter. I guess I could set the ttl in my flake though.
Oh, yea, anything that can be set in nix.conf can also be set on the CLI like --option tarball-ttl 0. The --tarball-ttl argument is actually just shorthand for --option tarball-ttl, and not all of the CLI tools support this shorthand for every option.
yea, I’m fairly sure. And it would be --option tarball-ttl 0, not --option tarball-ttl=0. I’m not sure why that wouldn’t be working. Unless maybe --flake doesn’t respect tarball-ttl? But I’m fairly sure it does. So I’m surprised it isn’t working for you.
Hm. I tried both versions (“tarball-ttl=0” and “tarball-ttl 0”) without success.
Also not sure which position to add the “–option” at - or whether that matters.
@tcurdt I ran into the same problem while developing my flake on one machine and continually doing nixos-rebuild switch on another. It seems there is an (undocumented, or at least not present in the man-page) option called --refresh, which seems to ensure the flake is refreshed from Github, even if the cache is still considered fresh. Hope it helps.