Not everything is perfect when it comes to a fresh NixOS installation. Today I ramble on about the problems I’ve encountered and how I overcame them in NixOS.
It’s been about a week and a half since I installed NixOS. I’ve compiled over 130 generations of the system’s configuration.nix
file. I’ve installed and uninstalled programs to find out whether they suit my purposes. I’ve moved from using a desktop manager (KDE) to a window tiling manager (i3). I’ve begun reading the Nix language documentation to get a grasp of “The Nix Way” of things. Through all of these endeavours, I have encountered many issues and overcame (almost) all of them.
Using a file browser with i3
After installing i3, I realise that my default terminal had been replaced with xterm. For those that don’t know, xterm is a pretty terrible terminal emulator - it’s old and basically the complete barebones of what a terminal should do. Unfortunately, by installing i3 and removing plasma5 (a desktop manager which handles draggable windows etc.), I ended up removing Konsole, which is one the packages installed with plasma5.
In order to resolve this, I just kept the installation of plasma5 on my machine and then set i3 to be my default tiling manager. Yes! This somehow managed to solve the issue with Konsole! However, by installing i3, it apparently completely messed up _Dolphin - the default file browser which is installed with plasma5. The icons were broken, the background makes text unreadable and half of the features are just completely dead. Instead of fixing it, it was time to find a new file browser.
I bring up the issue to my good computer science friend and they inform me that ranger is a great popular file browser which is entirely accessed in the terminal. It seemed to have caught my interest at the time, so I went ahead and installed ranger. What a mistake that was. It’s a Vim inspired file browser and it so happens that I didn’t know how to use vim very well. Without a fleeting thought, I uninstalled ranger and decided to search for something else.
My other computer science friend informed me that there is a file manager for the Gnome desktop environment, called Nautilus. I install that and huzzah! A file browser that actually has icons on it! Despite being a very bare file browser with minimal features, it seems to have met my requirements for what a file browser should be able to do.
Installing i3status-rust
i3status-rust is a status bar for the i3 tiling manager written entirely in rust. Installing it on NixOS is a piece of cake, you add i3status-rust
to the list of system packages in your configuration.nix
file (or install it using nix-env -i
). However, the version that is available on nixpkgs (A Nix package repository) is outdated and doesn’t have the latest and greatest features that are available with the current version on the GitHub repository. In order to resolve this, I decided to install it from source.
On the i3status-rust GitHub repository, it states how to install it using a few simple commands:
1
2
3
4
$ git clone https://github.com/greshake/i3status-rust
$ cd i3status-rust && cargo build --release
# Optional:
$ cp target/release/i3status-rs ~/bin/i3status-rs
Of course, it’s not so simple. I’m running NixOS. So I use what little Nix knowledge that I have available to me and open up a nix shell because I plan to build something (Apparently, opening nix shells and having custom environments are really really good for building code) I run the cargo build --release
command as stated after cloning the repository and surprise surprise, all of the compilation errors appear on my screen. Cannot find -l:libpulse.so.0. I just go to the simple solution of “Dump all of the dependencies into the environment packages” and I end up conjuring the following command that just worked:
1
sudo nix-shell -p cargo dbus pkgconfig libpulseaudio pulseaudio --pure --run 'cargo build --release'
Running Jekyll (again)
In a previous blog post, I wrote about how I was able to get jekyll to work on NixOS so I could see how my blog looked on my computer before submitting posts online. Between that post and now, I accidentally managed to delete something to make it not work. Perhaps I uninstalled ruby or deleted some old generation of my nix environment… I have no idea. However, it was not time to dwell on the mistakes - it was time to fix it as soon as possible!
Luckily, I had written a blog post on how to install jekyll for GitHub Pages! I followed the solution that I wrote and unfortunately, that did not seem to resolve the issue. Perhaps I needed ruby installed? I added ruby
to my configuration.nix
file and rebuilt the config. No luck. For some reason, bundle
- the command I used in the previous blog post to run jekyll - just wasn’t working. And by not working, I meant that it wasn’t installed. I used gem install github-pages
and magically, everything worked - bundler was finally installed! Unfortunately, nix-shell
seemed to not like the bundle
command for some arbitrary reason.
After a quick search online, I ended up deleting my Gemfile.lock
file a multitude of times, I ran bundle
and bundle install
a bunch of times and yet, whenever I ran bundle exec jekyll serve
, it refused to work because ruby-concurrency
was not found (despite it being shown when using bundle show
). Somehow, the fix for this entire system was to run bundle exec jekyll serve
outside of the nix-shell. Who knows why, but what works works. I’m not going to question it.
Adding themes to SDDM
SDDM is the Simple Desktop Display Manager which manages the login screen for Linux. With NixOS (in combination with plasma5), sddm comes with four themes pre-installed: breeze, maya, elarun and maldives. I decided it was tme for a new look and decided to install a new theme. I research online to find out that there’s this program called sddm-kcm (SDDM KDE Config Module) which provides a user interface to easily install themes. Using NixOS’ configuration.nix
file, I add plasma5.sddm-kcm
to the list of system packages and rebuild the configuration. Just as expected, the settings screen now has an option for adding themes to sddm!
I decide to browse the themes available to me and discover an amazing theme called plasma chili. Such a beautiful and clean login screen - perfect! I press the button to install the theme and the screen states that it’s been installed. I go back to the theme selection screen and to my surprise, plasma chili was not on the list of themes! How bizarre!
I search through my file system to find out that the sddm-kcm program just added the downloaded theme to the root folder, instead of the expected path for sddm. In this situation, I decide to poke around to find out where sddm is actually located and where it’s trying to read the themes from. I discover the sddm .nix file on GitHub and follow the code through (despite knowing basically nothing about the Nix language) to find the path where themes are installed on my system: /nix/store/da66in8f7k7gnw94rlkci890fjf1p0cr-system-path/share/sddm/themes
.
After finding the theme folder, I decided it would be simple to just copy and paste the theme into that folder - but alas, that folder is read-only! I do a quick look online and discover a configuration setting that disables the read-only setup from the /nix/store/
folder. Now, I know that it’s not a good idea to mess around with this stuff, so I make a very informed decision to do it anyway. I add nix.readOnlyStore = false;
to my configuration.nix
file and add a symlink to the desired theme of my choice. (In the end, I chose to go with the clairvoyance theme that so happens to have been created by one of my computer science friends).
Fixing the input method for SDDM
For some very peculiar reason, whenever SDDM launches and the password box is in focus, the entire screen goes black and is filled with an entire virtual keyboard. After a lot of research and searching through all of the folders relating to SDDM, I discover the SDDM configuration file. Inside the configuration file was a configuration option called InputMethod
and for some reason, that was defaulted to qtVirtualKeyboard
.
Now, because that file is inside the read-only part of the system, there was no way to possibly change this value (unless of course, you add nix.readOnlyStore = false;
to your configuration.nix
file). After an eternity of searching and “cheap hot-fixes” by modifying that immutable file (which regenerated whenever I rebuilt the NixOS configuration), I discovered the solution: add the following code to the configuration.nix
file!
1
2
3
4
xserver.displayManager.sddm.extraConfig = ''
[General]
InputMethod=
'';
Setting a background wallpaper
So I wanted to add a background wallpaper. Not a problem, just go to the desktop settings, and select an image from my file browser. A piece of cake really.
Then I wanted to install i3. No problem, just go to the configuration.nix
file and set i3 to be the default tiling manager. A piece of cake really.
Now I want to have a background wallpaper and have i3 at the same time. Oh boy. My computer doesn’t like the sound of that. I look online and find out that lots of people use this program called “feh”. It so happens that this program is just an image viewer with the added feature that one of its commands can set a background wallpaper: feh --bg-fill /path/to/image.png
. Knowing this, I decided to add this to the list of commands to run when the computer starts up, by adding xserver.displayManager.sessionCommands = ''feh --bg-fill ~/Documents/Background.jpg''
to my configuration.nix
file. Unfortunately, this did not seem to resolve the issue and each time I logged in or restarted my computer, I was greeted with a black background.
When I thought all was lost, I ended up locating a section of the NixOS wiki (And I’m pretty sure it’s the only resource on the entire internet that tells you about this) that explains how to add a wallpaper to i3 - just rename the image you want to .background-image
and put it in your home directory!
Conclusion
In the end, almost all of the problems that arise with this system can almost always be fixed by one of the following:
- Reading the NixOS wiki (chances are, they have a very specific page on how to install and configure exactly what you want)
- You compile it yourself using
nix-shell
and hope for the best