NixOS: Difference between revisions
Appearance
No edit summary |
|||
| Line 41: | Line 41: | ||
nixos-install | nixos-install | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Make sure to add the swap config: | |||
<pre> | |||
swapDevices = [ { | |||
device = "/swapfile"; | |||
size = 4096; # In MB | |||
} ]; | |||
</pre> | |||
=== Install on VPS === | |||
For a VPS, first install Ubuntu or Debian. | |||
Then run https://github.com/elitak/nixos-infect. | |||
== Resources== | == Resources== | ||
* https://nixos.org/manual/nixos/stable/ | * https://nixos.org/manual/nixos/stable/ | ||
* https://wiki.nixos.org/wiki/NixOS_Wiki | * https://wiki.nixos.org/wiki/NixOS_Wiki | ||
Latest revision as of 23:16, 21 December 2025
Install
The graphical installer is trivial. However, the minimal ISO doesn't handle partitioning for you.
Partitioning and Formatting
# Create a new GPT partition table
parted /dev/sda -- mklabel gpt
# Create the EFI Boot partition
parted /dev/sda -- mkpart ESP fat32 1MB 512MB
parted /dev/sda -- set 1 esp on
# Create the Root partition (ext4)
parted /dev/sda -- mkpart primary ext4 512MB 100%
# Format partitions
mkfs.fat -F 32 -n boot /dev/sda1
mkfs.ext4 -L nixos /dev/sda2
# Mount the root partition
mount /dev/disk/by-label/nixos /mnt
# Mount the boot partition
mkdir -p /mnt/boot
mount /dev/disk/by-label/boot /mnt/boot
# Create a 4GB swapfile (adjust size as needed)
dd if=/dev/zero of=/mnt/swapfile bs=1M count=4096
chmod 600 /mnt/swapfile
mkswap /mnt/swapfile
swapon /mnt/swapfile
Generate a config and install
nixos-generate-config --root /mnt
# Edit the config to your desire
nano /mnt/etc/nixos/configuration.nix
nixos-install
Make sure to add the swap config:
swapDevices = [ {
device = "/swapfile";
size = 4096; # In MB
} ];
Install on VPS
For a VPS, first install Ubuntu or Debian. Then run https://github.com/elitak/nixos-infect.