My experience when switching to NixOS - Part 5

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 ./;
    interactiveShellInit    = builtins.readFile ./;

Here I import the aliases, which are specified in pure nix. I also enable the completion for bash and I read the and 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!