NixOS
I run the NixOS distribution of GNU/Linux on my laptop.
Here are useful notes on it.
Installation
The installation instructions for NixOS are difficult to follow precisely.
To make your USB stick:
sudo dd if=Downloads/nixos-graphical-18.03.132543.8aa385069f8-x86_64-linux.iso of=/dev/sdb
The partitioning instructions are a bit unhelpful. Try using cgdisk or gparted instead. A lot less likely to go wrong.
Once done, make sure to mount both partitions (this is in the instructions, but easy to miss).
mount /dev/disk/by-label/nixos /mnt mkdir -p /mnt/boot mount /dev/disk/by-label/boot /mnt/boot
Lastly, it's easy to boot into a position where you don't have any networking. Make sure network-manager is enabled in your configuration.nix.
If you get into a pickle, you can always boot back into the installer, remount your partitions, and run the install again.
nixos-install --root /mnt
Dual Boot with Windows
## If you don't set this, Windows will get the time wrong time.hardwareClockInLocalTime = true; boot.loader = { systemd-boot.enable = true; efi.canTouchEfiVariables = true; }
Deleting Old Generations
When you do sudo nixos-rebuild switch
, an entry gets added to EFI for the new generation.
Additionally, you may get a new version of the Linux kernel.
These get stored inside /boot.
NixOS generations use the same mechanism as Nix profiles. They are stored in /nix/var/nix/profiles/system.
As a consequence, you can operate on them using nix-env some-operation -p /nix/var/nix/profiles/system
.
## List all the NixOS configurations we've made in the past sudo nix-env --list-generations -p /nix/var/nix/profiles/system ## Delete some old generation sudo nix-env --delete-generations 10000 -p /nix/var/nix/profiles/system