KDE - Official NixOS Wiki
Jump to content
From Official NixOS Wiki
KDE Plasma
is a desktop environment that aims to be simple by default, powerful when needed.
Installation
To use KDE Plasma, add this to your configuration.nix:
❄︎
configuration.nix
# Enable Plasma
services
desktopManager
plasma6
enable
true
# Default display manager for Plasma
services
displayManager
sddm
enable
true
# To use Wayland (Experimental for SDDM)
wayland
enable
true
};
# Optionally enable xserver
services
xserver
enable
true
⚠︎
Warning:
SDDM
is no longer supported on the unstable branch, users on unstable should use
Plasma Login Manager
instead. See configuration later in this page.
Configuration
Excluding applications from the default install
Some optional packages can be excluded if they are not needed at the cost of functionality.
Optional packages:
[1]
❄︎
configuration.nix
environment
plasma6
excludePackages
with
pkgs
kdePackages
plasma-browser-integration
konsole
elisa
];
Default Wayland/X11 session
Plasma 6 runs on Wayland by default. To launch an X11 session by default:
❄︎
configuration.nix
services
displayManager
defaultSession
"plasmax11"
Unlock KDE Wallet with LUKS password
When using LUKS disk encryption and autologin in your display manager, it is possible to unlock KDE Wallet with the LUKS password. Set the LUKS password, login password, and KWallet keyring password all to the same string, and for NixOS 25.11 and below use the following configuration:
boot
initrd
systemd
enable
true
systemd
services
display-manager
serviceConfig
KeyringMode
"inherit"
security
pam
services
sddm-autologin
text
pkgs
lib
mkBefore
''
auth optional
${
pkgs
systemd
/lib/security/pam_systemd_loadkey.so
auth include sddm
''
For Plasma Login Manager in NixOS 26.05 or above, use:
boot
initrd
systemd
enable
true
systemd
services
plasmalogin
serviceConfig
KeyringMode
"inherit"
security
pam
services
plasmalogin-autologin
rules
auth
systemd_loadkey
order
control
"optional"
modulePath
${
pkgs
systemd
/lib/security/pam_systemd_loadkey.so"
};
plasmalogin
order
control
"include"
modulePath
"plasmalogin"
};
};
Troubleshooting
Qt/KDE applications segfault on start
This is caused by a stale QML cache
(see this issue)
. A dirty way to fix this is by running on a terminal the following command:
find
${
XDG_CACHE_HOME
:-
$HOME
/.cache
/**/qmlcache
-type
-delete
GTK themes are not applied in Wayland applications / Window Decorations missing / Cursor looks different
This affects GTK applications including Firefox and Thunderbird.
You may need to set a GTK theme
Breeze
imitating the KDE theme with the same name in
System Settings -> Application Style -->Configure GNOME/GTK Application Style
(See this issue)
After Update to Plasma 6 Signal-Desktop complains about a Database Error involving kwallet5
Close Signal
Open ~/.config/Signal/config.json
Replace
"safeStorageBackend": "kwallet5"
with
"safeStorageBackend": "kwallet6"
(change 5 to 6)
Start Signal
Bluetooth configuration not available
Add the following configuration (generally in hardware-configuration.nix):
hardware
bluetooth
enable
true
This will add the following packages:
bluedevil
bluez-qt
pkgs
openobex
pkgs
obexftp
Brightness and Color brightness control sets gamma instead of brightness on external monitors
To allow
powerdevil
(and by extension the "Brightness and Color" status tray menu) to control brightness on supported monitors directly instead of adjusting gamma,
configure your system to enable ddcutil
, and allow your user to use DDC/CI without root.
Tips and tricks
Plasma-Manager
Note:
Plasma-Manager
is a community project
By default, the Plasma configuration can be handled like on
traditional systems
With
plasma-manager
, it is possible to make Plasma configurations via nix by providing
home-manager
modules.
User icon (avatar)
You can add a profile picture to your user by using a png file in
~/.face.icon
Hacking
There are many reasons to modify the KDE packages, such as testing patches from other KDE developers, applying a fix before it is officially released and finds its way into
nixpkgs
or developing contributions for the KDE project.
Customizing
nixpkgs
To override KDE packages, the common way using
overrideAttrs
won't work, since they are part of the
kdePackages
scope, which requires the usage of
overrideScope
first:
nixpkgs-overlay
final
prev
kdePackages
prev
kdePackages
overrideScope
kdeFinal
kdePrev
somepackage
kdePrev
somepackage
overrideAttrs
prevPkgAttrs
someattribute
};
};
};
The following examples will demonstrate various ways how to achieve the customization of the KDE package
powerdevil
in different scenarios:
Using a single diff from a remote URL
A KDE developer might have provided a diff that one wants to utilize locally to test it or to make use of it until it's included in an upcoming release.
Generate the SRI hash of the file:
nix store prefetch-file https://invent.kde.org/plasma/powerdevil/-/commit/f731c18e377b87c57f7205d9c1812a34f588c577.diff --json --name toggle-nightlight.diff
Override the
patches
attribute of the
powerdevil
package:
kdePackages
prev
kdePackages
overrideScope
kdeFinal
kdePrev
powerdevil
kdePrev
powerdevil
overrideAttrs
prevPdAttrs
patches
prevPdAttrs
patches
or
[]
++
prev
fetchpatch
name
"toggle-nightlight.diff"
url
"https://invent.kde.org/plasma/powerdevil/-/commit/f731c18e377b87c57f7205d9c1812a34f588c577.diff"
sha256
"sha256-X0ZHSRnSLqmp2fcLGx9DUTn7F9BFh5puh9Q4YAj6/5o="
})
];
});
});
Using commits of a repository
Either a local clone or remote repository might provide the code that should be used to build the package in question instead.
Remote repository
kdePackages
prev
kdePackages
overrideScope
kdeFinal
kdePrev
powerdevil
kdePrev
powerdevil
overrideAttrs
prevPdAttrs
src
builtins
fetchGit
url
"https://invent.kde.org/plasma/powerdevil"
rev
"f731c18e377b87c57f7205d9c1812a34f588c577"
};
});
});
Local repository
Note:
This will ignore files that are present in the worktree, but not committed yet.
kdePackages
prev
kdePackages
overrideScope
kdeFinal
kdePrev
powerdevil
kdePrev
powerdevil
overrideAttrs
prevPdAttrs
src
builtins
fetchGit
url
"file:///home/eliasp/code-repositories/public/KDE/plasma/powerdevil"
rev
"f731c18e377b87c57f7205d9c1812a34f588c577"
};
});
});
Using the worktree of a local repository
Note:
Since this relies on reading directly from the filesystem during the build, the impure mode has to be used, e.g.:
nixos-rebuild --impure …
Now one might not want to commit each and every change during development to iterate more quickly, but to just rebuild after having saved the latest changes.
By just redirecting
src
to the path of the working directory, where the required code resides, quick & dirty rebuilds are possible:
kdePackages
prev
kdePackages
overrideScope
kdeFinal
kdePrev
powerdevil
kdePrev
powerdevil
overrideAttrs
prevPdAttrs
src
/home/eliasp/code-repositories/public/KDE/plasma/powerdevil
});
});
Retrieved from "
Categories
Desktop environment
Applications
KDE
KDE
Add topic
US