Nix: flakes: `nix flake update` without arguments does not update

Created on 3 Jul 2020  路  8Comments  路  Source: NixOS/nix

Describe the bug
When running nix flake update I would expect Nix to update all inputs, however, nothing happens.

It does function when forcing with --recreate-lock-file or when updating an individual update with --update-input.

nix-env --version output

Nix at 6ff9aa8df7ce8266147f74c65e2cc529a1e72ce0.

bug

Most helpful comment

Yes, we could have nix flake update be equivalent to --recreate-lock-file.

All 8 comments

Big +1 from me. From my nixup script:


  # flakes (TODO: no really, what does this do?)
  nix --experimental-features 'nix-command flakes' --pure-eval \
    flake update --no-registries

  # TODO: Why does this ever have an effect? Needs to allow for more aggression
  nix --experimental-features 'nix-command flakes' --pure-eval \
    flake update --no-registries \
      --update-input master --update-input stable ...

We should probably just remove nix flake update since it doesn't do anything that other commands don't. I.e. nix flake update --update-input nixpkgs; nix build is equivalent to nix build --update-input nixpkgs.

Does nix build only update nixpkgs or update all inputs? Considering also https://github.com/NixOS/nix/issues/3779 I have seen nix build do an update, but now, I can not get nix build to update anything by itself, unless explicitly using any of these flags.

Edit: nevermind,I see now there is a semicolon instead of a dot.

I was hoping that nix flake update would remain and would do the same as nix flake update --update-input [input] where --update-input [input] is specified for every input to the flake.

Yes, we could have nix flake update be equivalent to --recreate-lock-file.

that was also my expectation when first using nix flake update; that it would update all of the sources.

Just to check my understanding, I came here to ask for a nix flake update --update-all-inputs, but it seems like maybe nix flake update --recreate-lock-file does this?

Can someone confirm, --recreate-lock-file explicitly invalidates the cache, and/or aggressively checks each flake input for updates? (I feel like I've seen it be recreated before and still use cached values from somewher else, so I'm not sure.) Thanks!

Yes, --recreate-lock-file will update everything.

nix flake update implies --refresh so it will check cached inputs. This is in fact the only difference between nix flake update and other nix commands.

Was this page helpful?
0 / 5 - 0 ratings