NixOS 21.05 installation failed (installing from an existing distro)

Hello this is my first post. I’ve been trying to install 21.05 from an existing Archlinux installation.
i was following this from the manual:
https://nixos.org/manual/nixos/stable/index.html#sec-installing-from-other-distro

For me the installation is failing with:

getting attributes of path ‘/nix/store/qcpdgqki4y0mi015dkh4ahgsrfbsf3hs-firmware-linux-nonfree-2021-05-11’: No such file or directory

cannot build derivation ‘/nix/store/5y2ld59rjk4bksch49dm35k71bs8fdws-firmware.drv’: 1 dependencies couldn’t be built

The firmware-linux-non-free-2021-05-11 is actually present in the /mnt/nix/store/

The install log:

➜  ~ sudo PATH="$PATH" NIX_PATH="$NIX_PATH" `which nixos-install` --root /mnt

building the configuration in /mnt/etc/nixos/configuration.nix...
these derivations will be built:
  /nix/store/px4l47n7nnvyhka61m3d3f8gvvaqrm6b-find-libs.drv
...
  /nix/store/zwd4k2350wh17m68d1xqx5hnncyr8mfz-e2fsprogs-1.46.2-bin
copying path '/nix/store/in621vh2kj0ayqa6qc9pqnjvx6hzj5h5-glibc-locales-2.32-46' from 'https://cache.nixos.org'...
copying path '/nix/store/bqi1wyq0zfkwn8nr0dcrl8g1km1aafdb-acl-2.3.0-doc' from 'https://cache.nixos.org'...
copying path '/nix/store/2k9ayx8d2rhy38qwzynjvizsldmm97fs-acl-2.3.0-man' from 'https://cache.nixos.org'...
copying path '/nix/store/nq68vm77dic5zinziyx0nb4wqbw0prs1-alsa-firmware-1.2.1' from 'https://cache.nixos.org'...
copying path '/nix/store/69c0pjxfiyiy5wh4gzlyd39jp0yyq286-attr-2.4.48-doc' from 'https://cache.nixos.org'...
copying path '/nix/store/4w6a46mwzwq1j2kh51jnf0aczd0wyri0-attr-2.4.48-man' from 'https://cache.nixos.org'...
copying path '/nix/store/qs9a2pdxsxpz1gmqfdf71bm9acxdy3wf-bash-completion-2.11' from 'https://cache.nixos.org'...
copying path '/nix/store/vwypc0il9cry67xwydbipari0cb2z4p4-bind-9.16.16-man' from 'https://cache.nixos.org'...
copying path '/nix/store/qn2dcsnb8q3dqj614hk0i20vindi399a-busybox-static-x86_64-unknown-linux-musl-1.32.1' to 'local'...
copying path '/nix/store/i6f5bgrnmiyahfjjfx5rnrll7zcv6ki7-bzip2-1.0.6.0.2-man' from 'https://cache.nixos.org'...
copying path '/nix/store/402g0l8zfz658mzrpwkxh3d77q6vy257-ca-certificates.crt' from 'https://cache.nixos.org'...
copying path '/nix/store/wqk3jicw4fsd6apr0kxl8hidywhww4xd-coreutils-8.32-info' from 'https://cache.nixos.org'...
copying path '/nix/store/659764zgnrfmhszvvadp0m982sahxmg2-curl-7.76.1-man' from 'https://cache.nixos.org'...
copying path '/nix/store/4v5dqx1pjyxp5nnmfrx7id8qm779z7l1-dejavu-fonts-minimal-2.37' from 'https://cache.nixos.org'...
copying path '/nix/store/89s10x5r1rqrxrg3ifj0j0df4cfgwlmi-diffutils-3.7-info' from 'https://cache.nixos.org'...
copying path '/nix/store/z4gykan3ymmk1ainnyfm3ylfcwq06vg9-dns-root-data-2019-01-11' from 'https://cache.nixos.org'...
copying path '/nix/store/z8by6i4jbyl4wgh6yz2q2hvg6lxby3bb-fc-10-nixos-rendering.conf' from 'https://cache.nixos.org'...
copying path '/nix/store/fi4b8iii1d7kwk1x6sac9c5fs5dga5hf-fc-52-nixos-default-fonts.conf' from 'https://cache.nixos.org'...
copying path '/nix/store/bf0acr3pldby4w3dh7nmsrs9j3dr414z-fc-53-nixos-reject-type1.conf' from 'https://cache.nixos.org'...
copying path '/nix/store/07lswn9xia4132cqmxa2r9ax2vz84dmv-fc-53-no-bitmaps.conf' from 'https://cache.nixos.org'...
copying path '/nix/store/b9vzjfq651hxh68s792il8w3hpzkh5gj-fc-cache' from 'https://cache.nixos.org'...
copying path '/nix/store/qcpdgqki4y0mi015dkh4ahgsrfbsf3hs-firmware-linux-nonfree-2021-05-11' from 'https://cache.nixos.org'...
getting attributes of path '/nix/store/qcpdgqki4y0mi015dkh4ahgsrfbsf3hs-firmware-linux-nonfree-2021-05-11': No such file or directory
copying path '/nix/store/rpnv6q1bn85gkhjhm14arpvf38zyl0r7-fc-00-nixos-cache.conf' from 'https://cache.nixos.org'...
cannot build derivation '/nix/store/5y2ld59rjk4bksch49dm35k71bs8fdws-firmware.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/2xi6r8imbvavxi4vi9yilb1nsxzh9h7z-nixos-system-nixos-21.05.961.1f91fd10406.drv': 1 dependencies couldn't be built
error: build of '/nix/store/2xi6r8imbvavxi4vi9yilb1nsxzh9h7z-nixos-system-nixos-21.05.961.1f91fd10406.drv' failed
➜  ~ 

configuration.nix

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Use the GRUB 2 boot loader.
  boot.loader.grub.enable = true;
  boot.loader.grub.version = 2;
  # boot.loader.grub.efiSupport = true;
  # boot.loader.grub.efiInstallAsRemovable = true;
  # boot.loader.efi.efiSysMountPoint = "/boot/efi";
  # Define on which hard drive you want to install Grub.
  boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only

  # networking.hostName = "nixos"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Set your time zone.
  # time.timeZone = "Europe/Amsterdam";

  # The global useDHCP flag is deprecated, therefore explicitly set to false here.
  # Per-interface useDHCP will be mandatory in the future, so this generated config
  # replicates the default behaviour.
  networking.useDHCP = false;
  networking.interfaces.enp0s19f2u3.useDHCP = true;
  networking.interfaces.enp3s0.useDHCP = true;
  networking.interfaces.wlp0s18f2u2.useDHCP = true;

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Select internationalisation properties.
  # i18n.defaultLocale = "en_US.UTF-8";
  # console = {
  #   font = "Lat2-Terminus16";
  #   keyMap = "us";
  # };

  # Enable the X11 windowing system.
  # services.xserver.enable = true;


  

  # Configure keymap in X11
  # services.xserver.layout = "us";
  # services.xserver.xkbOptions = "eurosign:e";

  # Enable CUPS to print documents.
  # services.printing.enable = true;

  # Enable sound.
  # sound.enable = true;
  # hardware.pulseaudio.enable = true;

  # Enable touchpad support (enabled default in most desktopManager).
  # services.xserver.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  # users.users.jane = {
  #   isNormalUser = true;
  #   extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
  # };

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  # environment.systemPackages = with pkgs; [
  #   vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
  #   wget
  #   firefox
  # ];

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "21.05"; # Did you read the comment?

}

do you mind doing nix-shell -p nix-info --run "nix-info -m" and pasting the content?

EDIT: also looks related to 21.05 not installing - #18 by Alderaeney

At this point I think nix isn’t doing something correctly

 - system: `"x86_64-linux"`
 - host os: `Linux 5.12.9-arch1-1, Arch Linux, noversion`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.12`
 - channels(root): `"nixpkgs-21.05.961.1f91fd10406"`
 - channels(vin): `"home-manager, nixgl"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Before that i was on nixpkgs-unstable but had the same problem.

I tried the nix-build workaround before nixos-install and it worked!
https://github.com/NixOS/nixpkgs/issues/126141#issuecomment-861720372

The installation seems perfect, everything booted without any problem.
But in the nixos-install step I’ve been getting perl locale warning (even after setting LOCALE_ARCHIVE)
and systemd-tempfiles chroot error.
Are these errors/warnings concerning?

nixos-install output:

...
building '/nix/store/rhj6kdyz6hfzdj7xzl0rx3ymj7r3rl18-unit-reload-systemd-vconsole-setup.service.drv'...
building '/nix/store/m6sqqz5v2zfspd17n53gsjqk0zfh041j-wait-for-pstore.sh.drv'...
building '/nix/store/4xf9ylib1khslsdr23xdyw03hqz656qa-xlock.pam.drv'...
building '/nix/store/gqli9srxkhwg4w0i4i26dshm8971kf8b-unit-mount-pstore.service.drv'...
building '/nix/store/pzgvb2vkv4fffyq6yfb3i2hjwy94m9f9-xscreensaver.pam.drv'...
building '/nix/store/by5jxnqcnlz4ampb2bl562jjplj777nc-system-units.drv'...
building '/nix/store/03w8imrnpzk047g1563w11pry2j8mkni-etc.drv'...
building '/nix/store/24d2p60zq3gis6ygfj6394352w3bi5ib-nixos-system-nixos-21.05.1139.20d353f6491.drv'...
/nix/store/91nyn21naw5b750393km5zpav1vhj5yn-nixos-system-nixos-21.05.1139.20d353f6491
installing the boot loader...
setting up /etc...
chroot: failed to run command ‘systemd-tmpfiles’: No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "",
        LC_ALL = (unset),
        LANG = "en_IN.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
updating GRUB 2 menu...
setting up /etc...
chroot: failed to run command ‘systemd-tmpfiles’: No such file or directory
setting up /etc...
chroot: failed to run command ‘systemd-tmpfiles’: No such file or directory
setting root password...
New password: 
Retype new password: 
passwd: password updated successfully
installation finished!