First NixOS Graphical Install¶
Prerequisites¶
- You do NOT need the
nixCLI (here). - Have a VM manager available, e.g. VirtualBox, GNOME Boxes, etc.
- Download the latest
nixos-graphical-*-x86_64-linux.isofrom https://nixos.org/download.
Installation¶
- Boot the ISO in a new VM (using BIOS instead of UEFI).
- The NixOs Installer should have started automatically - step through it.
- As we'll initial focus on a minimal headless server installation chose No Desktop (for now).
- At the end, shut-down the VM, remove the installation ISO image, and restart the VM.
You now have your very first NixOS-based (VM) machine!
PS: The screen & font may be tiny; we'll fix that later.
Nix files¶
The result of the graphical configuration from the previous step is stored in /etc/nixos/configuration.nix (and its hardware-configuration.nix).
You can edit that file to further customize your NixOS installation.
SSH¶
Let's enable SSH access! Edit /etc/nixos/configuration.nix and uncomment the following line:
Run sudo nixos-rebuild switch to apply the changes.
Test that SSH is working by connecting locally from the VM to itself:
To connect from the host to the VM, find out the VM's IP address
(e.g., using ip a on the VM; for GNOME Boxes, it may be 192.168.122.x),
and connect to that IP address from your host machine:
Packages¶
Let's install some packages, like git and perhaps the fish shell - and any others you may want.
Edit /etc/nixos/configuration.nix and add the following lines inside the top-level { config, pkgs, ... }: block:
Note that NixOS has environment.systemPackages as well as a packages in the users.users.<your-username> section.
We're using environment.systemPackages here to install packages system-wide for now, and will revisit user-specific packages later.
After editing, run sudo nixos-rebuild switch again; you now have git and fish installed.
Git¶
It's a good idea to keep your NixOS configuration files in a Git repository. Create your own nixfiles Git repository now - similar to this! Then do something like:
TODO Beware that if you use a layout like this repo,
then you cannot directly put the configuration.nix
and hardware-configuration.nix files into it...