[Nix-dev] [Unable to upgrade GCE Nixos Image: Requires version > nix-1.10

James Cook james.cook at utoronto.ca
Mon Feb 20 06:36:42 CET 2017


On 20 February 2017 at 04:57, rohit yadav <rohityadav at utexas.edu> wrote:
>
>
> On Sun, Feb 19, 2017 at 10:18 PM, rohit yadav <rohityadav at utexas.edu> wrote:
>>
>>
>>
>> On Sun, Feb 19, 2017 at 10:08 PM, James Cook <james.cook at utoronto.ca>
>> wrote:
>>>
>>> On 19 February 2017 at 23:51, rohit yadav <rohityadav at utexas.edu> wrote:
>>> > Hi,
>>> >
>>> > I am trying to upgrade a nixos machine on GCE created from the old
>>> > tempalted
>>> > 14.12. I am unable to do so. I receive following error:
>>> >
>>> > [root at localhost:~]# nixos-rebuild switch
>>> > building Nix...
>>> > error: syntax error, unexpected $undefined, expecting '"', at
>>> >
>>> > "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/sources.nix":52:49
>>> > (use ‘--show-trace’ to show detailed location information)
>>> > error: syntax error, unexpected $undefined, expecting '"', at
>>> >
>>> > "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/sources.nix":52:49
>>> > (use ‘--show-trace’ to show detailed location information)
>>> > error: evaluation aborted with the following error message: ‘This
>>> > version of
>>> > Nixpkgs requires Nix >= 1.10, please upgrade! See
>>> >
>>> > https://nixos.org/wiki/How_to_update_when_Nix_is_too_old_to_evaluate_Nixpkgs’
>>> > error: getting status of ‘/root/@nix_x86_64_linux@’: No such file or
>>> > directory
>>> > warning: don't know how to get latest Nix
>>> > building the system configuration...
>>> > error: syntax error, unexpected $undefined, expecting '"', at
>>> >
>>> > "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/sources.nix":52:49
>>> > (use ‘--show-trace’ to show detailed location information)
>>> >
>>> > Note: I have already upgrade nix to 1.11 even then it continues to
>>> > complain
>>> > about it.
>>> >
>>> > Thanks,
>>> > Rohit
>>>
>>> Strange... just to confirm, what does "nix-env --version" show when
>>> you run it as root?
>>
>> As I mentioned earlier, the version is 1.11.6.
>> [root at localhost:~]# nix-env --version
>> nix-env (Nix) 1.11.6
>
> I notice that nix-env in current-system/sw directory is still nix-1.8. I am
> not sure why it is not updating even though in my root environment, I have
> nix-1.11.6. Any clue, how to fix this?
>
> [root at localhost:/var/run/current-system/sw/bin]#  nix-store -q --references
> /var/run/current-system/sw | cut -d'-' -f2- | grep nix
> nix-1.8
> nixos-install
> nixos-version
> nixos-build-vms
> nixos-checkout
> nixos-option
> nixos-rebuild
> nixos-manpages
> nixos-help
> nixos-generate-config
> nixos-container
>
>
>>
>>
>> Thanks,
>> Rohit
>>
>>
>

The instructions at
http://lists.science.uu.nl/pipermail/nix-dev/2013-March/010874.html
look promising, though it's from 2013, so proceed with caution.

Here's what I think is happening:

a) When you run nixos-rebuild, it doesn't automatically find the
latest version of nix you installed. Instead, it uses a specific store
path built in to the nixos-rebuild script.

b) My hope is the instructions in the link above will give you a newer
nixos-rebuild, which will in turn use a newer version of nix.

c) To answer your question about nix-1.8: well, I think that's not
exactly the problem (see (a)). But if you installed nix-1.11 using
nix-env, it ended up under $HOME/.nix-profile.
/var/run/current-system/sw is separate, and probably still has
whatever software your image came with, unless you've run
nixos-rebuild successfully since then.

James


More information about the nix-dev mailing list