musicmatzes blog

nixos

So I (re)installed NixOS on my old Notebook yesterday and today. Besides some small problems it worked like a charm. Read about it here.

Why did I reinstall?

Well, the old setup was fine. Besides one thing: I hadn't my configuration repository on the device. You may think, well, where is the problem? Just install git and clone it from the other machines, right? The point is, I like to keep my configuration parts private and only share snippets of it if someone asks. Also because there are passwords in it and so on. You know what I mean.

That's why I need disc encryption when I want to clone my configuration repository on a device. So I had to reinstall the device because it had no disc encryption. No problem, as nixos is awesome!

The process of reinstalling

Well, it was really simple: Boot the USB stick, format the drive with fdisk and create encrypted volumes with cryptsetup, then mount them and create file systems with mkfs. Then mount these and do a nixos-install – smooth as hell!

After that, I edited the configuration.nix file which was created by nixos-install, so had vim and git available when rebooting – also smooth as hell.

But then, I did the big mistake.

The problem

I was a bit tired yesterday, so apologies here. But I actually did adduser. Of course, it worked for the first step. I then logged in with this user, edited the configuration.nix file to have the user as well, rebuild the system and rebooted. The user still existed, but the packages were not available. I had already cloned my configuration repository onto the encrypted drive and linked it from the /etc/nixos/configuration.nix path, but the packages were not available to the user.

The solution

The solution I found this morning was rather simple: I had two boot loader configurations in my configuration files, as my workstation machine boots via gummiboot for UEFI but the old notebook had to use grub. Two bootloader definitions are not that good – the bootloader didn't get any updates, so I always rebooted into the same generation, resulting in a way to old environment, where the packages were not available.

I fixed this one and also removed everything which was related to the user I had created. I did a nixos-rebuild switch. The user got created, the bootloader got its update.

Everything worked.

Awesomeness

So, overall, you can reproduce by:

  • Don't be tired when installing a OS
  • fdisk
  • cryptsetup
  • mkfs
  • mount
  • nixos-install
  • vim
  • nixos-rebuild

in this order.

And you have everything available. It is SO awesome. I just logged into the machine over SSH and did some things. It was SO easy, because I didn't need to reinstall all my stuff, I already had it available and it worked. That's pure awesomeness to me (pun intended)!

tags: #linux #nixos

Yesterday I was at tübix in Tübingen, Germany. And it was awesome, thank you guys for making this event happening!

There were several really interesting talks for me, starting with, of course, a talk about NixOS, held by a NixOS guy I didn't knew by then. Joachim was there, too, and we had a nice chat about but not limited to NixOS! Thank you for beeing great, Joachim!

Afterwards I attended the talk about mutt and gpg, which was held by Sven, a really nice and inspiring guy who likes colors.

Afterwards I switched to the lightning talks, where I arrived just in time to see Ingo talking about Haskell. Oh my god, I really like this guy! He was really charged with energy when he started talking about Haskell. Awesome! I had a little chat with him afterwards about how to learn Haskell, as I still have some problems (not with Monads, as he assumed first, but) with getting the theory to do practical things for me. Thank you for the nice time, Ingo!

After some pizza, which was really tasty, I learned about pandoc from Kurt (no link here, sorry). And with this talk, I got to learn about a tool which I can use to write my thesis, so big thanks to Kurt for this! We also had some short chats where I learned even more about Pandoc and what it is able to do! Thanks a lot!

Then I went back to the room of the lightning talks, where several LUGs presented what they are doing and so on and I was forced to talk about UnFUCK without further preparation. I don't mind it, thank you all for listening and giving me the opportunity to talk about the Unix Friends and User Campus Kamp at my University!

Then I went to a talk about Network Steganography held by my former fellow student Florian. Thank you, too, Florian, I've learned another bunch of things, so: Success!

After that I saw some notes from Joachim on nice stuff from the net and a talk about functional programming in C++ which was more or less a selling talk for Haskell. I don't mind it, of course. It convinced me even more not to get an C++ programmer, because holy shit, this language sucks!

The exit talk was nice as well and afterwards we had some more time to socialize and talk with people and so on. But then we had to drive home again. It was an absolutely awesome day and I'd really love to be there again in 2016! Hopefully this was not the last tuebix!

tags: #social #software #linux #nixos

This part is about running (as far as I think) insecure applications on NixOS. How'd you do that? Well... my approach is docker!

Read it here.

So, docker. I learned from docker when it was introduced. I guess it was two years ago or something like that. I never used it, though. But today, I use it. And I use it on NixOS!

The first thing you have to do is to put

  virtualisation.docker.enable = true;

into your configuration.nix file. Of course, you also have to install it. This depends on where you want to use it, so put it either in your systemPackages configuration or install it in your user profile with nix-env -i docker or, if it works (I didn't try) with nix-env -iA pkgs.docker to be a bit faster.

Be sure your user is in the "docker" group! This one is really important. I actually had a bit of an issue (well, “a bit” is well said, I couldn't run anything... so I had a big issue) with docker because I forgot to put my user into this group.

After the last step, you have to logout and login again.

So, now you should be able to run docker containers! I found a blog post by Jessie Frazelle, where she explains how she runs, for example, lynx in a docker container. She also provides examples for how to run chrome in docker, including google talk plugin!

Other stuff she shows:

  • skype
  • spotify
  • gparted (huh?)
  • tor browser
  • mutt
  • irssi

Awesome, huh? You can not run Skype as container! This is awesome. I won't do it, though. Skype is still spyware! Also remember: docker is not to run apps which are eventually evil. Especially not if these apps can access the X server!

Jess has also a github repository where she stores docker files for much more applications:

  • atom
  • chromium (I'm running chromium, not chrome, actually)
  • mailman
  • transmission

... to name a few.

tags: #linux #nixos

I've done it. This blog post is written from my NixOS installation on my new machine. Have a look inside to see a screenshot and my experience with the actual setup of a real machine with NixOS.

So, the setup is not that simple, so I ran into some issues, of course. But maybe I should list my hardware first, at least the relevant parts:

  • Processor: AMD FX-8320 (8 x 3,5 GHz)
  • Graphics Card: MSI AMD Radeon R9 270X Twin Frozr 2GB GDDR5
  • Motherboard: Gigabyte GA-990FXA-UD3

Plus two 3TB WD drives and a 120 GB Samsung EVO SSD. I guess the other parts are not relevant here and now.

Configure all the things!

I started by doing a simple NixOS installation, everything worked. Then I restarted it and encrypted the drives. This got me into some trouble, because it did not work that simple. After booting with the appropriate settings (for encryption), the bootloader was shown and after that there was just nothing shown. It was really scary! After adding the ext4, dm_crypt and the fbcon (which is for message printing during early boot) I got the password prompt from luks, so everything was fine from there. I had to play around with the actual cryptdevice configuration, but I got it working really fast. After that, I simply copied my configuration.nix over to the machine and tried to rebuild the system. It failed. But it failed because of a simple reason: I added a 900,000 lines /etc/hosts entry to my nix configuration before copying it over to the machine. That was a bit too much, so I had to comment it out.

I'm running on NixOS for a few weeks now and I still have some problems, but they are all very specialized ones. For example, I use youcompleteme as autocompletion engine for vim. But it cannot find the standard headers, as these are obviousely not installed in /usr/include! That's one of the issues I can remember at the moment. But hey, it works!

tags: #linux #nixos

In this part of the series, I will describe my bash setup, as I promised at the end of the last part of the series.

Also, I finally ordered my new machine! I will, of course, show you some facts about the machine and as soon as all parts have arrived, I will publish an article about building the machine etc!

But first, the bash setup. If you've read the last part of the series, this won't be that special for you. The approach is similar, but not that complex, of course.

So first, I had to add a new subdirectory in my ~/config/nixos/ directory. I named it programs, as all program configuration should go there. Inside this directory there is a directory named bash. Inside these directories there are the normal default.nix files.

The programs/default.nix file looks like this:

{
    programs.bash = import ./bash/default.nix;
}

So nothing special here. The programs/bash/default.nix file looks almost similar:

{
    shellAliases            = import ./aliases.nix
    enableCompletion        = true;
    promptInit              = builtins.readFile ./prompt.sh;
    interactiveShellInit    = builtins.readFile ./functions.sh;
}

Here I import the aliases, which are specified in pure nix. I also enable the completion for bash and I read the prompt.sh and functions.sh file which are located in the same directory. These files are normal bash scripts.

And that's basically it! Nothing complicated here, as you see! Of course, you can still provide your normal ~/.bashrc file and define your stuff here, but for a system-wide bash configuration, this is just awesome! Your bash setup gets compiled into your system, which means when going back to a previous configuration, the bash configuration goes back to! I really like that! And, of course, you should also be able to ship your bash configuration to a remote host. But I'm not sure about this one.


I also managed to get my next package into the luakit repository: luakit! I finally packaged luakit for nixos. It is not battle-tested yet, but as luakit will be my next browser, I will battle-test it as soon as I'm on NixOS myself!


Well, this article was rather short, but I have nothing more to tell you right now. Maybe next week, if I managed to build my machine until then!

Stay tuned! tags: #linux #nixos

So I promised I will explain my vim setup in this part of the series. And of course, I will do this.

The requirements

The requirements are fairly easy here. I wanted to be able to use YouCompleteMe with vim, so I need a vim with Python support enabled. So, I absolutely need the configurable vim package from the NixOS package tree and I clearly must override it. And when doing this step, I can remove all the stuff from the vim package I do not need.

Another requirement was that I can replace vim with neovim. I've not done this yet, but I guess it should be fairly easy.

Because not all vim plugins are in the NixOS packages, I need to be able to build my own packages outside of the NixOS package tree and pack them into my store as well.

And, because vim needs to know all these plugins, I must be able to override the runtimepath variable in the vim configuration, the vimrc. So, I need to be able to compile the vimrc out of the package definition as well.

The setup

The directory setup here is fairly easy. I have my normal configuration folder whereas I created a folder vim inside the pkgs folder:

config/nixos/ | +– ./pkgs/ | +– vim.nix +– vim | +– override.nix +– pkgPlugins.nix +– plugins.nix +– vimrc/ | +– colorscheme.vim +– filetypes.vim +– ... +– vimrc.nix

Let me elaborate what is located where here.

vim.nix

The top-level file for the vim packaging. This file is actually included in my machine-specific configuration or in the pkgs/basePackages.nix file, so my vim is always installed on every system. The latter is the way I want to do this, so I have the same vim on all systems.

This file returns a list.

vim/override.nix

This file simply contains the overridden vim package.

This file returns a package / derivation.

vim/pkgPlugins.nix

This file contains the already packaged plugins. I do not have to compile them, as they are already in the NixOS package tree, which makes certain things simple but others more complex, we will see why.

This file returns a list.

vim/plugins.nix

Self-packaged plugins. Period.

This file returns a list.

vim/vimrc.nix

This file uses all files in pkgs/vim/vimrc/*.vim and compiles them into one giant string and writes this one as vimrc file to the store. Actually, there is a pkgs/vim/vimrc/plugins.nix file in the directory which compiles pkgs/vim/vimrc/plugins/*.vim files into a string and returns that string, which simply gets included in the vimrc. I did this for abstraction, so the configuration for each file lives into the appropriate subdirectory.

The How

Lets start with the easy parts here first. To override vim, you don't really have to do much things. What you have to do can be explained best with the appropriate nix file:

Override vim

{ pkgs, lib, vimrc }:

let vim = lib.overrideDerivation pkgs.vimconfigurable (o: { aclSupport = false; cscopeSupport = true; darwinSupport = false; fontsetSupport = true; ftNixSupport = true; gpmSupport = true; hangulinputSupport = false; luaSupport = true; multibyteSupport = true; mzschemeSupport = true; netbeansSupport = false; nlsSupport = false; perlSupport = false; pythonSupport = true; rubySupport = true; sniffSupport = false; tclSupport = false; ximSupport = false; xsmpSupport = false; xsmpinteractSupport = false;

postInstall = (o.postInstall or “”) + '' ln -sf “${vimrc}” “$out/share/vim/vimrc” ''; }); in vim

Of course, you have to make sure that this is the only occurance of vim in your package setup. And if you install vim in a user environment, it will override this as well, so be warned!

So I ripped out everything I don't need here, which is for example tcl support. I don't even know what tcl is, actually.

You also need to override the postInstall hook to ensure you link the vimrc to the appropriate path. The vimrc file must be passed to this function, as you can see in the first line.

Packaged plugins

The second thing which is fairly easy is the file for the plugins which are already in the NixOS package repository. What I do here is simple:

{ stdenv , pkgs }:

[ pkgs.vimPlugins.youcompleteme # pkgs.vimPlugins. # ... ]

And yes, it is that simple. I will not share my entire config files here, of course. You don't need to know what kind of plugins I use in my vim setup!

More plugins!

Now comes the more difficult part. I actually copied these definitins from aszlig:

{ stdenv , pkgs , lib , writeTextFile , writeText , buildEnv , fetchgit , vim_configurable }:

with stdenv;

let

# ... here were some things I did not need

mkVimPlugins = plugins: buildEnv { name = “vim-plugins”; paths = with lib; mapAttrsToList (const id) plugins; ignoreCollisions = true; postBuild = '' find -L “$out” -mindepth 1 -maxdepth 1 -type f -delete ''; };

pluginDeps = { };

plugins = mkVimPlugins (pluginDeps // {

vimvim-fugitive = fetchgit { url = “https://github.com/tpope/vim-fugitive"; rev = “”; sha256 = “”; };

# ...

});

in [plugins]

As you can see, this file is a bit longer than the previous ones. I only inserted the fugitive plugin for posting here, obviousely. So how does this work? Each plugin gets fetched with git (for fetching from vimscripts or other methods of fetching, look at aszligs repo, this file, actually). After it was fetched from git, it is inserted in a set which is afterwards fed to the mkVimPlugins function, which adds all the plugins to one package. All plugin pathes are added to the package then. Why you need the ignoreCollisions = true; line... I'm not sure but I guess it ensures that two plugins can have files with same names. I'm also not sure about the postBuild hook.

But that's how it is supposed to work. It returns a list of plugins, then.

Lets build a vimrc!

Yes, I actually compile my vimrc out of nix expressions. That's not that hard, it is actually string concatenation, because I do write .vim files.

{ stdenv, writeText, additionalRTP }:

let

generic = builtins.readFile ./vimrc/general.vim; # ... statusline = builtins.readFile ./vimrc/statusline.vim; # ...

plugins = import ./vimrc/plugins.nix;

in

writeText “vimrc” '' ${generic}

set runtimepath+=${additionalRTP} set runtimepath+=${additionalRTP}/after set runtimepath+=${additionalRTP}/share/vim-plugins

${statusline}

${plugins} ''

That's really easy: I read the files which contain the vim configurations (general configuration, statusline, etc) and put them all together.

What I add as well: The additional runtime path. This is actually required because when installing vim packages which are not in the package tree of NixOS by now, vim cannot find these. When adding the additional runtime path here, I tell vim to look in these directories as well, ensuring that the plugins can be found.


The last point is obviousely one point I have to clean up, because I guess there should be a better way how to do this. As you might notice when setting up your vim configuration on NixOS, there is also an plugin manager for vim you can use from within NixOS/the nix packages. It gives you lazy loading of vim plugins and all these nice things you want to have. I'm not sure how this fits into the way how NixOS packages vim plugins, I guess I have to dig around here a bit.

Anyhow, it works. On my testing machine, which is an rather old machine (not that old, but also not the new shit, you know) vim starts up in about 1 second. This is obviousely way to much for a machine I want to use for developing software, but for this machine it is okay.

Maybe this will get better after cleaning up the setup, I'm not sure.


In the next part of the series, I will explain my bash(rc) setup, which is handled by nix, of course. Maybe I can also elaborate on my vim setup, if I managed to clean up the mentioned parts. tags: #linux #nixos

In the last part of the series I described what my requirements for a NixOS installation are and why I wanted to switch to it (and KDE).

In this part I describe how I installed my second machine (a Toshiba Notebook) with NixOS and how I got some things running.

The machine

I had NixOS installed on a virtual machine in the first place and I already had it on the mentioned Toshiba Notebook. But this installation was removed in favour of a complete reinstall (including disk formatting and everything). So this is actually a installation from scratch, whereas I kept the configuration files.

The machine I installed NixOS on is a Toshiba Notebook, a Toshiba Satellite PRO S300L.

Machine Data:

  • Intel Core 2 Duo Processor @ 2,00 GHz
  • 3 GB RAM
  • 160 GB HDD
  • Mobile Intel GMA 4500MHD Graphics
  • 15,4” WXGA TFT Display

Yes, it is an old machine, but that does not matter.

The Installation

The installation was really basic. I actually followed the NixOS installation guide pretty much.

After booting the live image, I formatted the disk to have approx. 75GB for the root partition and the rest (which was another approx. 75GB) for /home. I did that because I want to play with this machine, so a big root partition is important for me at this point. For a productive installation on this machine I would've used only 50GB, but not less. The Nix package manager actually needs more disk space for the packages as other package managers, but that's part of the approach and won't change in future, I guess. Anyhow, 75GB is not that much nowadays!

I formatted both partitions with ext4. Pretty basic stuff here, no encryption or something, no LVM, actually.

After this stuff was done, I copied the configuration file from my backup stick to /etc/nixos/configuration.nix, including all the parts I outsourced into .nix modules and fired up a nixos-install. It build my complete system, which I was able to boot afterwards!

Now, how's that, Archlinuxers? It actually build my entire system including boot loader, mount points, services and desktop! I can actually use this piece of hardware now! I can use it productively!

That's my sellings point No. 1 of NixOS! You don't have to mess around anymore!

The KDE desktop.

I did some small configurations for the KDE desktop. Actually, I bound ALT-j, ATL-j, ALT-k and ALT-L and so on, to have some basic vi-like key bindings.

I also added some desktop widgets, but that's not of a big deal as well.

Here are some screenshots:

Blank KDE

Dirty KDE

Nothing interesting, huh? It's just a basic KDE desktop, of course!


So, in the next part I will elaborate a bit on my configuration setup. Maybe I will explain a bit of the syntax of the Nix expression language. I will clearly elaborate on the appraoch and maybe show a way how to build another system out of the already provided parts of my configuration.

Stay tuned!

tags: #linux #nixos

In the last part of the series I descripted what I did to install KDE on the machine and promised to explain the configuration setup in this article.

The KDE was removed since, as I read some comments from people raging against Kontact/KMail/Akonadi and that it is bloat which does not work. So, I'm back at i3 and the “old” setup. Anyways, the configuration setup did not change, and I will explain it in this part of the series.

Kontact or no Kontact

So, Akonadi, KMail, Kontact and the whole stuff does not work. I've heard that from several people at reddit and in several IRC channels. So I'm back at my old setup, including

  • offlineimap / msmtp for mailing services
  • mutt as mailreader (was: Kmail)
  • remind as calendar (was: KOrganizer)
  • wyrd as calendar interface (was: KOrganizer)
  • taskwarrior as task tool (was: KOrganizer)
  • abook as address book (was: KAdressbook)

The point is, that I must get this tools to get working with eachother properly to have something like Kontact. And I will do so.

But, of course, this is another problem and I will explain it in another blog post, maybe.

The configuration setup

That's the part you're interested in most, I guess. So here we go. I've already described the problem, I have several machines, which have some parts of configuration which is same on every machine, but some parts differ.

My approach is simple. I have several subsets of configuration I can include into eachother to build a complete configuration. My folder structure looks like this:

~/config/ | +– nixos/ | +– fs/ +– nixpkgs/ +– pkgs/ +– services/ +– users/

in ./nixpkgs/ I simply symlinked the ~/.nixpkgs/config.nix for version controlling purposes (~/config is a git repository on my machines).

So, I have several sets of configuration sorted by kind of configuration.

fs

The ./fs/ subdirectory contains file system configurations for each machine. Of course, these parts cannot be re-used by other machines most of the time, but I keep them in a special subdirectory to keep my setup clean and modular.

A file ./fs/some.nix looks like this:

{ ... }: { fileSystems.“/home” = { device = “/dev/sda2”; fsType = “ext4”; options = “nosuid,nodev,relatime”; }; }

for example.

pkgs

In the ./pkgs/ subdirectory, there are package sets defined. Namingly:

./pkgs/ | +– basePackages.nix +– desktopPackages.nix +– devPackages.nix

by now. Each of these files look like so:

pkgs: [ pkgs.mosh pkgs.tmux ... ]

for example.

services

A file in ./services/ defines one service. I can include a service file for simply “installing” the services.

My ./service/ file for redshift looks like this, for example:

{ services.redshift = { enable = true; latitude = “48.059402”; longitude = “8.464087”; temperature = { day = 5500; night = 3700; }; }; }

Simple stuff.

users

And last, but not least: ./users/. I don't think I have to explain this one, it looks like the service or file system definitions.

The machine configuration

What's more important and interesting, is the actual machine configuration. The machine configuration is a single file which lives in my ~/config/nixos/ folder and is named like the host.

So, nox.nix, which is the configuration file for my testing machine, looks literally like this:

{ config, pkgs, ... }:

let configDir = /home/m/config/nixos; in

{ imports = [ # Base configuration “${configDir}/base-configuration.nix”

# Users “${configDir}/users/m.nix”

# Services “${configDir}/services/synergyClient.nix” “${configDir}/services/x.i3.nix” “${configDir}/services/redshift.nix” “${configDir}/services/networkmanager.nix” ];

# Define on which hard drive you want to install Grub. boot.loader.grub.device = “/dev/sda”;

networking.hostName = “nox”;

environment.systemPackages = let basePkgs = import “${configDir}/pkgs/basePackages.nix” pkgs; devPkgs = import “${configDir}/pkgs/devPackages.nix” pkgs; desktopPkgs = import “${configDir}/pkgs/desktopPackages.nix” pkgs; in basePkgs ++ devPkgs ++ desktopPkgs;

}

That's the whole deal. You may notice, that there is a base-configuration.nix, I include in this file. This is a very generic default configuration for each machine. It simply defines the following stuff:

  • use grub2, but not where to install it
  • system language
  • default shell (bash for me)
  • timezone
  • enable “sudo”

So this is really just basic stuff each machine has to be configured to.

After linking the /etc/nixos/configuration.nix to the appropriate file in the configuration directory, nixos can be rebuild and everything just works ™.

Feel free to copy the described setup and adjust so it fits your needs! Feel also free to ask me questions about it.


In the next article of this series, I will explain my vim setup including the plugin setup. Be prepared, it will be awesome to manage all you vim plugins with the Nix package manager!

Stay tuned! tags: #linux #nixos

As you might have noticed, I'm about to switch to NixOS, the purely functional Linux distribution ™. Here are some toughts on Racket on NixOS.

First, why Racket? Well, my blog here is written using frog, the frozen blog tool which is written in Racket . It actually works really well for me and was not that much effort to setup – I'd recommend it to everyone.

But this isn't about frog, this is about racket. So, I need Racket for my blog. But I also like Racket, I played with it some time ago and it is a neat language, really!

Because of my switch to NixOS I wanted to try whether I can compile my blog on NixOS, so I installed Racket on my NixOS-testing machine. And you know what is awesome?

It. Just. Worked.

When installing racket, the racket language distribution ships everything you need. It ships the racket interpreter, it ships DrRacket, the Racket-IDE, the REPL, the package manager for racket. I was able to install frog and compile my blog in 3 steps.

  1. Install racket
  2. Install frog using the racket package manager
  3. Compile the blog

Well, you actually do not use the nix package manager when doing the upper steps, which is, of course, impure. But I wanted to focus on whether it works or not here, not on purity. Of course it would be much better to be able to install frog via the nix package manager, keeping everything in the nix store. But that's not possible (yet), I guess. tags: #linux #nixos #nix #blog

This will be a series of blog posts about my experience when switching to NixOS, the Purely Functional Linux Distribution.

It will cover everything: The successes, the issues, the problems, everything you can imagine, including my personal NixOS configuration, so you can learn how to get your feet wet with this blog series.

But, of course, this is not a tutorial on how to write Nix or how to use NixOS. This is an experience report.

The Why

So, why did I switch or do I want to switch? I'm a Archlinux user for more than 7 years now. Archlinux is a great distribution, you can tweak every single bit to fit your needs perfectly. It is truly awesome. But there is a problem with it, I don't want to have anymore: You can really easily break things. You can break your packages by upgrading a version of a library. You can pollute your package database by installing something and shortly afterwards removing it, but forgetting to remove the dependencies it pulled in. You have no option to actually tweak packages. You want emacs? Okay, here is emacs. You want it with GTK3 instead of GTK2? Then, compileit yourself. (I picked emacs as example here because that's the one example on the NixOS page, there is certainly a package for emacs with GTK3 in Archlinux)!

Another big selling point for me is, that NixOS comes with either the stability of Debian, if you want it to, but you can be bleeding-edge like Archlinux if you want to. It's in your hands with NixOS!

Of course, in NixOS, you only have one configuration file for all the things!

Configure all the things!

The How

So, I started playing around with NixOS in a virtual machine. I started with a minimal configuration which is shipped with the system. Of course, I read a lot of blog articles beforehand, so I almost knew what I did. Well, at least I thought, I knew it.

There are great resources online. Well, there are not that much resources around, but at least the ones that are there are really good. My starting point, of course, was the NixOS homepage, the NixOS wiki, but also the great blogging series Nix Pills which explains the Nix language.

What was also worth looking at is the real world NixOS Dotfiles page, where links to dotfiles of NixOS people are collected. Mine are not up there, because I tend to keep my dotfiles private, so you won't find them there. But you find them here!

The requirements

My requirements for NixOS should be listed before I go into detail how I managed to get things done.

Configuration files

So, first, I wanted to be able to track my configurations with git. I track all my configurations with git, as this enables me to mess around with them without actually losing them/information/knowledge/bla. I think you get that point.

Well, that was not much of an issue, actually. I just created a new folder in my dotfiles directory and linked the global NixOS configuration file to it:

mkdir config/nixos
sudo cp /etc/nixos/configuration.nix config/nixos/
sudo chown $USER config/nixos/configuration.nix
sudo mv /etc/nixos/configuration.nix /etc/nixos/configuration.nix.bkp
sudo ln -s config/nixos/configuration.nix /etc/nixos/configuration.nix

As you can see, I backuped the configuration before overriding it, just to be safe here.

Well, this actually works out really well. But! There is a but!

When installing a new machine, you actually cannot do this, because your NixOS installation doesn't know of /home yet (as it is not mounted at this point). To work around this, you simply use the /etc/nixos/confuiguration.nix file until you have set up the basic system!


I also wanted the configuration files to be shareable between several machines, which required me to split them up into several parts. I already described this in another blog post!

KDE!

Well, packages. As I described in the other blog post mentioned above, I have several sets of configuration which I merge into eachother to compile the machine-specific configuration out of several parts then. This works really well and I use it every day!

One big thing I wanted to have was KDE. Yes, me, the Archlinux-i3-minimalistic-terminal-only-loving guy tries KDE. Why? Well, that's another topic!

Turned out that KDE works really good for me! I tweaked some shortcuts, so I'm able to do “tiling” with it (but not with this ugly “Tiling” script for KWin, actually!) so it works really well for me and I really like it.

But there also were some problems, I will tell you later on.

Services

For the services department: I want to be able to run a gitolite instance, I already run a ssh server, synergy (client) and redshift. I did not try the synergy client on my latest install, but beforehand it worked, so I assume it still works. Redshift and ssh work, so that's none of an issue.

What does not work is gitolite. I don't know why, yet, but I will do some further investigation on this.

Overall requirements

Well, one big requirement for me is that things just work. I did not write “work out of the box”, because this requirement was already destroyed when this blog article was written. I don't want to mess around with things every now and then – I want them to work, so I can be productive in things I actually want to do.

So, that's also the reason why I wanted a switch to KDE. I want to use the Kontact suite, including KOrganizer, KMail, KAddressbook and not mutt with abook anymore, which works, but is not that great IMHO. I mean, mutt, yeah! It is awesome and fast and everything. But I cannot do contact managing, scheduling, etc with it. As an email reader it is the best piece of software I ever used and in combination with vim, it becomes even more awesome! But it does not integrate with other tools like an adressbook or day planner.

Also, all these things can integrate my Android phone, which is awesome. I did not try it yet, though.


So, that's enough for the first part. In the next part of the series, I will describe my steps from zero to a basic system and how I installed the configurations and things. Maybe the post will also cover my first problem with NixOS.

Stay tuned!

tags: #linux #nixos