For Beginners

From NixOS Wiki
Jump to: navigation, search

This is a tutorial for installing NixOS with a basic config in a Proxmox VM. I'll document the path step by step.

Get the the install media

Searching "nixos install media" for the latest Iso

Install from ISO

I install to a Proxmox VM with pretty much default settings. Except, I want use a spice(qxl) gpu. That gives me the possibility to use Virtual Machine Viewer as Networked KVM ). So I can have cut and paste later down you also want to enable qemu agent, so maybe do that.

I add the ISO as bootmedia and start the machine and get greeted by the bootmanager:

Upon selection of the first entry I get a staged boot.


Here's the result of booting the live Iso system

At this point nixos is running but not yet installed on the VM-Hardrive. Pretty sure it runs in a ramdrive, a loopdevice, idk?

Well, it's a full system, and I can pretty much use it. What I want now though is cut and paste, and for that I use ssh.

enable ssh

I check for the ip address with ip a , for me it just worked. https://nixos.org/nixos/manual/index.html#sec-installation-booting-networking here I find systemctl start sshd and with sudo that works.

Actually I also have to decide a pw now. Either for root or for the nixos user.

Configuration.nix

Anyway, https://discourse.nixos.org/t/adding-qemu-guest-agent-to-a-nixos-vm/5931 shows a more nixos way, so to say. The configuration.nix needs to be edited and the configuration needs to be applied to the system. nano /etc/nixos/configuration.nix however yields no writable result, and nixos-generate-config as well.

No ramdisk after all? Nope, I was not root. :D

With sudo nano /etc/nixos/configuration.nix I can do changes:

and with sudo nixos-rebuild dry-build I test if it builds. And foolishly sudo nixos-rebuild switch and I get the following:


prepare the harddrive

Next step will be to prepare the harddrive. At this point I want the most rudimentary installation to go by default. Sadly I don't think there is some automatic partitioning going on and the way to go is basically to with partition and format.


Setup Cut and paste in spice

Fair enough, but I am lazy, so I want to cut and paste and spice alone is not enough to achieve that. You need qemu-agent for that.

The live system does not have qemu-agent installed and I install it with nix-env -iA nixos.qemu-utils.


However, the service does not run directly or is listed. And that might be where nixos starts being different for me, but maybe I just hold it wrong here.