For Beginners

From NixOS Wiki
Jump to: navigation, search

This is a medium basic tutorial that aims at building a basic nix install.

You might want to have experience with Linux, I'll document the path step by step. Setup is being done on a virtual system, although I'll expand on other systems later.


Get the the install media

Searching "nixos install media" yields no direct results for me, although the NixOS_Installation_Guide links to [1] that in turn links to 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: Nixosbootmenu.png

Upon selection of the first entry I get a staged boot that shows me the following issue: NixosBootError.PNG

Not sure if that is relevant.


Here's the result of booting the live Iso system

NixosBooted.PNG

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.

FirstFails.PNG

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

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

ConfigNix.PNG

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

Nixos-rebuild switch.PNG

but what do I actually want in my config

I want to try i3. http://johnduhamel.io/posts/2019-01-29-nixos-i3-setup.html I would like to run a virtualized windows that can do looking glass/host-gpu takeover x2vnc Services, obviously some pulseaudio(+server with or without avahi), maybe an icecast server firefox chromium or sth better


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. NixosLiveCDVirtmanager.PNG


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.