I have a Thinkpad T490 with 8GB of RAM on which I want to declaratively install my Nix Flake using disko-install. I’m using the latest NixOS Graphical Gnome ISO and from the Gnome Terminal I ran the following commands:
# password for full disk encryption
echo "changeme" > /tmp/secret.key
sudo nix \
--extra-experimental-features "nix-command flakes" \
run 'github:nix-community/disko/latest#disko-install' -- \
--write-efi-boot-entries \
--flake github:MatejaMaric/nix-setup#thinkpad-t490 \
--disk main /dev/nvme0n1
It runs for couple of minutes and then the entire Gnome Terminal gets killed. I checked my system logs with journalctl --boot and it shows that nix-build gets killed by the Linux OOM Killer with peak memory usage of 5.3GB.
It seems to me that disko-install tries to download all the nix packages that my flake uses directly into RAM. Maybe I’m wrong…
Here’s something interesting I’ve figured out. If I use plain disko to format and mount my file systems, and use nixos-install for the rest, everything works normally. Here’s an example:
In my case the main difference here being that using disko and then nixos-install allows disko to mount any SWAP partitions you might have, potentially avoiding memory issues.
For some reason disko-install does not mount SWAP partitions because it builds the system first before it creates the partitions layout. It would be nice if its behavior was closer to that of just disko, or a flag that allows it to do the installation in two steps.