I've recently grabbed an old VM and tried to upgrade it straight from NixOS version 15.03 to version 16.09. Following the steps in the NixOS Manual I ran into the following issue:

[root@mymachine:~]# nixos-rebuild switch
building Nix...
building the system configuration...
error: unknown hash algorithm ‘sha512’
(use ‘--show-trace’ to show detailed location information)

This seems to be caused by using a version of Nix which does not yet support the hash type sha512.

After a quick investigation I came across this Issue which helped me to find an easy 2-step workaround for upgrading the system:

  1. Change /etc/nixos/configuration.nix temporarily

    The trick was to comment out all entries in environment.systemPackages and then run nixos-rebuild switch to update the system.

  2. Change /etc/nixos/configuration.nix back and update again

    After the first step nixos-rebuild switch was working just fine, since it had the new version of Nix available and could handle the hash type sha512 now.


Comments

comments powered by Disqus