Unable to install new nixos

I’m migrating from an unencrypted system to an encrypted system and when I ran nixos-install from the original NixOS installation I got:

...
mktemp: failed to create directory via template ‘/tmp/os-prober.XXXXXX’: No such file or directory
lsblk: /dev/mapper/no*[0-9]: not a block device
lsblk: /dev/mapper/block*[0-9]: not a block device
lsblk: /dev/mapper/devices*[0-9]: not a block device
lsblk: /dev/mapper/found*[0-9]: not a block device
mktemp: failed to create directory via template ‘/tmp/os-prober.XXXXXX’: No such file or directory
mktemp: failed to create directory via template ‘/tmp/os-prober.XXXXXX’: No such file or directory
You have a memory leak (not released memory pool):
 [0x1c77980] dtree
Internal error: Unreleased memory pool(s) found.
You have a memory leak (not released memory pool):
 [0x1c77980] dtree
Internal error: Unreleased memory pool(s) found.
You have a memory leak (not released memory pool):
 [0x1c77980] dtree
Internal error: Unreleased memory pool(s) found.
You have a memory leak (not released memory pool):
 [0x1c77980] dtree

...

Internal error: Unreleased memory pool(s) found.
You have a memory leak (not released memory pool):
 [0x95d980] dtree
Internal error: Unreleased memory pool(s) found.
installing the GRUB 2 boot loader on /dev/nvme0n1p1...
Installing for i386-pc platform.
/nix/store/lg6ppgfgc0pswf58hdhicncjx2lr0i5g-grub-2.04/sbin/grub-install: warning: File system `fat' doesn't support embedding.
/nix/store/lg6ppgfgc0pswf58hdhicncjx2lr0i5g-grub-2.04/sbin/grub-install: error: embedding is not possible, but this is required for cross-disk install.
/nix/store/9973cimkkqk0j9jppvr58961i372q6rp-install-grub.pl: installation of GRUB on /dev/nvme0n1p1 failed: No such file or directory

I tried it multiple times (removed everything and started it again) and I got always the same error [0x1c77980].

I would like to report somewhere this issue, but I have no idea where. (github.com/NixOS/nixpkgs ?)

Also, my config is here: configuration.nix · 93c8d60a1ce2608aa0e45e8b7f26d7b604fb45f8 · Jan Kaifer / nixos · GitLab

Strange, I had to remove these lines and then it worked.

boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/nvme0n1p1";
/nix/store/lg6ppgfgc0pswf58hdhicncjx2lr0i5g-grub-2.04/sbin/grub-install: warning: File system `fat' doesn't support embedding.

This means that you are installing grub in BIOS/legacy mode to a partition instead (/dev/nvme0n1p1) of a full disk (/dev/nvme0n1).

Either you should install in UEFI mode, or you should install to a full disk.

Ah cool. Thanks for explaining and how do I do turn on UEFI mode?

please see nixos manual