Packaging a KDE Aurorae theme for NixOS

Hello! I’ve recently just started to dip my feet (ie. today) into NixOS, and wanted to get the look & feel of my previous KDE desktop back, including the themes I had applied. Now, the common way to install themes, and the way I’d do it under other distros would just be to go to the KDE settings app, under the theming section hit ‘Get new’ and download the theme that way. However, as I had just gone through the effort of installing NixOS, it seemed a bit self-defeating to just immediately start downloading & installing things in a way that doesn’t seem very Nix, and learning how to package software for Nix seemed like not too bad of a first-day challenge.

Eventually, after many hours of confusion which eventually lead me to just, R’ing TFM, I eventually figured out a solution that I thought would work. But alas, it doesn’t seem to.

What I did was I created a flake, with a package in it, as defined below:

{ stdenv, fetchFromGitHub, lib }: stdenv.mkDerivation {
  pname = "kde-decorations-aquarelle";
  version = "v1.2";

  src = fetchFromGitHub {
    owner = "klyushnik";
    repo = "aquarelle";
    rev = "162ac431b4c6d682fc907ed444400b9661c4a20b";
    sha256 = "0869r3y6ldhisbllrx4ard1j4km1si3r1hs7l3mrsqiby6l0y4vd";
  };

  installPhase = ''
    mkdir -p $out/usr/share/aurorae/themes/
    cp -r $src/* $out/usr/share/aurorae/themes/
  '';

  meta = with lib; {
    license = licenses.gpl3;
  };
}

I can build the package as part of the flake and it appears to have the right file set

fox@vulpes ~/flake> nix build .#aquarelle
fox@vulpes ~/flake> find result/
[...]
result/usr/share/aurorae/themes/AquarelleBlue/keepbelow.svg

and then imported that in my system NixOS configuration like so (which is not flake based, at least not yet)

{ pkgs, ... }: 
let 
  foxFlake = builtins.getFlake "/home/fox/flake";
  foxPkgs = foxFlake.packages.x86_64-linux;
in {
  environment.systemPackages = with pkgs; [
    kdePackages.aurorae
    foxPkgs.aquarelle
  ];
}

but, even after logging out & back in, checking KDE settings doesn’t show me the theme in the picker.

I have looked at other themes in nixpkgs and each had $out/share/… instead of $out/usr/share/.... Could this be the problem?

1 Like

Hm, yes. that does look like the issue, thank you for having a look for me! I’m still slightly curious on why this is the case. Is there documented standards for why paths would differ in Nix(OS) like this?

$out is basically the package’s /usr. For example, we use like ./configure --prefix=$out, where on FHS systems prefix would normally be /usr.

1 Like