KDE

From NixOS Wiki
Revision as of 07:06, 19 June 2021 by imported>Flexagoon

Installation

/etc/nixos/configuration.nix
services.xserver.desktopManager.plasma5.enable = true;

Enable GTK themes in KDE

Enable GTK themes in KDE in KDE System Settings

Nixpkgs now provides the GTK configuration module for KDE system settings, which you can install with:

$ nix-env -i kde-gtk-config

You should also install any GTK themes you like. You can choose a GTK theme and set related options in System Settings > Application Appearance > GTK.

Enable GTK themes in KDE manually

As a normal nix user you can install the Oxygen GTK theme:

$ nix-env -i oxygen-gtk

KDE will run any scripts you place in ~/.kde/env on startup so this is a good place to set the GTK_PATH so that applications can find the theme engine. If the path is wrong/unset you will see errors like this:

Gtk-WARNING **: Unable to locate theme engine in module_path

To set Oxygen-GTK as the gtk theme create the following file and make it executable: ~/.kde/env/set-gtk-theme.sh

#!/bin/sh

export GTK_PATH=$GTK_PATH:~/.nix-profile/lib/gtk-2.0
export GTK2_RC_FILES=$GTK2_RC_FILES:~/.nix-profile/share/themes/oxygen-gtk/gtk-2.0/gtkrc

Alternatively, on NixOS:

environment = {
  systemPackages = [ pkgs.oxygen_gtk ];
  shellInit = ''
    export GTK_PATH=$GTK_PATH:${pkgs.oxygen_gtk}/lib/gtk-2.0
    export GTK2_RC_FILES=$GTK2_RC_FILES:${pkgs.oxygen_gtk}/share/themes/oxygen-gtk/gtk-2.0/gtkrc
  '';
};

Or alternatively, copy the themes folder in the home directory

$ cp -R ~/.nix-profile/share/themes/ ~/.themes