Since today I’m getting
sudo nixos-rebuild switch
building the system configuration...
error: lock file '/nix/store/ncas0cl39dnz05vmcxkgb1nqzrqylnxb-source//flake.lock' has unsupported version 7
How do I fix it?
Since today I’m getting
sudo nixos-rebuild switch
building the system configuration...
error: lock file '/nix/store/ncas0cl39dnz05vmcxkgb1nqzrqylnxb-source//flake.lock' has unsupported version 7
How do I fix it?
You need to upgrade to a more recent version of Nix that supports the new lock file format.
nix profile install nix#nixFlakes
error: lock file '/nix/store/im96fvb0is9bp8pq42d2mr1w2b9pcb4w-source//flake.lock' has unsupported version 6
That’s the problem:to update to a version that support the more recent lock file I need the flake with the most recent lock format
I guess nixos-rebuild
has hard coded a older version of nix than your profile.
You can try to run
nix shell '.#nixosConfigurations.default.config.system.build.toplevel' -c switch-to-configuration swtich
to build and activate your system configuration with your current version of nix.
Of No because I have an older ofnix
Sorry, I thought only the rebuild was the problem. In this case, you can pull in a newer nix version from nixpkgs:
nix shell 'nixpks#nixFlakes' -c nix shell '.#nixosConfigurations.default.config.system.build.toplevel' -c switch-to-configuration swtich
or
nix profile install nixpkgs#nixFlakes
nix shell '.#nixosConfigurations.default.config.system.build.toplevel' -c switch-to-configuration swtich
That too failed because also the nix flake has a version too high
That is strange.
When I used a old build of nixpkgs#nixFlakes
I get the same error as you do:
% nix shell 'github:NixOS/nixpkgs/c86af902f443a7f0813467e734b0dcec92e9c2f9#nixFlakes' -c nix build nix
error: lock file '/nix/store/3zpa5parp65vjif5819qz6sqr7grasz5-source//flake.lock' has unsupported version 6
But with a current nixpkgs#nixFlakes
build it works as intended:
% nix shell 'github:NixOS/nixpkgs/c86af902f443a7f0813467e734b0dcec92e9c2f9#nixFlakes' -c nix shell 'nixpkgs#nixFlakes' -c nix build nix
% readlink result
/nix/store/0fl25z041j5j7n85jp9a8zw35ryl542n-nix-2.4pre20200701_6ff9aa8
Did you pin the nixpkgs
flake to a fixed version via nix registry pin
?
What is the output of nix flake info nixpkgs
for you?
% nix flake info nixpkgs
Resolved URL: github:NixOS/nixpkgs
Locked URL: github:NixOS/nixpkgs/730df00dfb6a22ed0b214ff99370cea250691d17
Description: A collection of packages for the Nix package manager
Path: /nix/store/icgx623izb73hsnh6qsd8bn9md27j1vk-source
Revision: 730df00dfb6a22ed0b214ff99370cea250691d17
Last modified: 2020-07-06 14:31:19
nix flake info nixpkgs ✔
Resolved URL: github:NixOs/nixpkgs/nixos-unstable
Locked URL: github:NixOs/nixpkgs/8d05772134f17180fb2711d0660702dae2a67313
Description: A collection of packages for the Nix package manager
Path: /nix/store/zyj4lmz9vx6x0lsvq2770kilnx37x4ii-source
Revision: 8d05772134f17180fb2711d0660702dae2a67313
Last modified: 2020-07-10 10:31:26