diff --git a/nixos/modules/services/x11/desktop-managers/kde5.nix b/nixos/modules/services/x11/desktop-managers/kde5.nix index dc6aa137cbd3..0f3cb5735e75 100644 --- a/nixos/modules/services/x11/desktop-managers/kde5.nix +++ b/nixos/modules/services/x11/desktop-managers/kde5.nix @@ -108,16 +108,26 @@ in kdeApps.okular kdeApps.print-manager + # Oxygen icons moved to KDE Frameworks 5.16 and later. (kdeApps.oxygen-icons or kf5.oxygen-icons5) pkgs.hicolor_icon_theme plasma5.kde-gtk-config - pkgs.orion # GTK theme, nearly identical to Breeze ] + + # Plasma 5.5 and later has a Breeze GTK theme. + # If it is not available, Orion is very similar to Breeze. + ++ lib.optional (!(lib.hasAttr "breeze-gtk" plasma5)) pkgs.orion + + # Install Breeze icons if available + ++ lib.optional (lib.hasAttr "breeze-icons" kf5) kf5.breeze-icons + + # Optional hardware support features ++ lib.optional config.hardware.bluetooth.enable plasma5.bluedevil ++ lib.optional config.networking.networkmanager.enable plasma5.plasma-nm ++ lib.optional config.hardware.pulseaudio.enable plasma5.plasma-pa ++ lib.optional config.powerManagement.enable plasma5.powerdevil + ++ lib.optionals cfg.phonon.gstreamer.enable [ pkgs.phonon_backend_gstreamer @@ -135,6 +145,7 @@ in pkgs.gst_all_1.gst-plugins-bad pkgs.gst_all_1.gst-libav # for mp3 playback ] + ++ lib.optionals cfg.phonon.vlc.enable [ pkgs.phonon_qt5_backend_vlc @@ -166,6 +177,14 @@ in # Extra UDEV rules used by Solid services.udev.packages = [ pkgs.media-player-info ]; + services.xserver.displayManager.sddm = { + theme = "breeze"; + themes = [ + plasma5.plasma-workspace + (kdeApps.oxygen-icons or kf5.oxygen-icons5) + ]; + }; + security.pam.services.kde = { allowNullPassword = true; }; }; diff --git a/nixos/modules/services/x11/display-managers/sddm.nix b/nixos/modules/services/x11/display-managers/sddm.nix index 5ca3a44324f6..d156f692f269 100644 --- a/nixos/modules/services/x11/display-managers/sddm.nix +++ b/nixos/modules/services/x11/display-managers/sddm.nix @@ -9,6 +9,8 @@ let cfg = dmcfg.sddm; xEnv = config.systemd.services."display-manager".environment; + sddm = pkgs.sddm.override { inherit (cfg) themes; }; + xserverWrapper = pkgs.writeScript "xserver-wrapper" '' #!/bin/sh ${concatMapStrings (n: "export ${n}=\"${getAttr n xEnv}\"\n") (attrNames xEnv)} @@ -22,6 +24,8 @@ let [Theme] Current=${cfg.theme} + ThemeDir=${sddm}/share/sddm/themes + FacesDir=${sddm}/share/sddm/faces [Users] MaximumUid=${toString config.ids.uids.nixbld} @@ -86,6 +90,14 @@ in ''; }; + themes = mkOption { + type = types.listOf types.package; + default = []; + description = '' + Extra packages providing themes. + ''; + }; + autoLogin = mkOption { default = {}; description = '' @@ -146,8 +158,7 @@ in services.xserver.displayManager.job = { logsXsession = true; - #execCmd = "${pkgs.sddm}/bin/sddm"; - execCmd = "exec ${pkgs.sddm}/bin/sddm"; + execCmd = "exec ${sddm}/bin/sddm"; }; security.pam.services = { diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix index 4dc221dba68b..9a2a77b31554 100644 --- a/nixos/release-combined.nix +++ b/nixos/release-combined.nix @@ -83,6 +83,7 @@ in rec { (all nixos.tests.openssh) (all nixos.tests.printing) (all nixos.tests.proxy) + (all nixos.tests.sddm) (all nixos.tests.simple) (all nixos.tests.udisks2) (all nixos.tests.xfce) diff --git a/nixos/release.nix b/nixos/release.nix index bf0dc2379b59..b5ac97b3b94f 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -287,6 +287,7 @@ in rec { tests.quake3 = callTest tests/quake3.nix {}; tests.runInMachine = callTest tests/run-in-machine.nix {}; tests.sddm = callTest tests/sddm.nix {}; + tests.sddm-kde5 = callTest tests/sddm-kde5.nix {}; tests.simple = callTest tests/simple.nix {}; tests.tomcat = callTest tests/tomcat.nix {}; tests.udisks2 = callTest tests/udisks2.nix {}; diff --git a/nixos/tests/sddm-kde5.nix b/nixos/tests/sddm-kde5.nix new file mode 100644 index 000000000000..476cb732e252 --- /dev/null +++ b/nixos/tests/sddm-kde5.nix @@ -0,0 +1,29 @@ +import ./make-test.nix ({ pkgs, ...} : { + name = "sddm"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ ttuegel ]; + }; + + machine = { lib, ... }: { + imports = [ ./common/user-account.nix ]; + services.xserver.enable = true; + services.xserver.displayManager.sddm = { + enable = true; + autoLogin = { + enable = true; + user = "alice"; + }; + }; + services.xserver.windowManager.default = "icewm"; + services.xserver.windowManager.icewm.enable = true; + services.xserver.desktopManager.default = "none"; + services.xserver.desktopManager.kde5.enable = true; + }; + + enableOCR = true; + + testScript = { nodes, ... }: '' + startAll; + $machine->waitForWindow("^IceWM "); + ''; +}) diff --git a/pkgs/applications/display-managers/sddm/default.nix b/pkgs/applications/display-managers/sddm/default.nix index dc891605d1b6..d2faf465106b 100644 --- a/pkgs/applications/display-managers/sddm/default.nix +++ b/pkgs/applications/display-managers/sddm/default.nix @@ -1,54 +1,80 @@ -{ stdenv, fetchpatch, makeQtWrapper, fetchFromGitHub, cmake, pkgconfig, libxcb, libpthreadstubs -, libXdmcp, libXau, qtbase, qtdeclarative, qttools, pam, systemd }: +{ stdenv, makeQtWrapper, fetchFromGitHub +, cmake, pkgconfig, libxcb, libpthreadstubs, lndir +, libXdmcp, libXau, qtbase, qtdeclarative, qttools, pam, systemd +, themes +}: let version = "0.13.0"; + + unwrapped = stdenv.mkDerivation rec { + name = "sddm-unwrapped-${version}"; + + src = fetchFromGitHub { + owner = "sddm"; + repo = "sddm"; + rev = "v${version}"; + sha256 = "0c3q8lpb123m9k5x3i71mm8lmyzhknw77zxh89yfl8qmn6zd61i1"; + }; + + patches = [ + ./0001-ignore-config-mtime.patch + ./0002-fix-ConfigReader-QStringList-corruption.patch + ]; + + nativeBuildInputs = [ cmake pkgconfig qttools ]; + + buildInputs = [ + libxcb libpthreadstubs libXdmcp libXau qtbase qtdeclarative pam systemd + ]; + + cmakeFlags = [ + "-DCONFIG_FILE=/etc/sddm.conf" + # Set UID_MIN and UID_MAX so that the build script won't try + # to read them from /etc/login.defs (fails in chroot). + # The values come from NixOS; they may not be appropriate + # for running SDDM outside NixOS, but that configuration is + # not supported anyway. + "-DUID_MIN=1000" + "-DUID_MAX=29999" + ]; + + preConfigure = '' + export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/lib/qt5/qml -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system" + ''; + + enableParallelBuilding = true; + + meta = with stdenv.lib; { + description = "QML based X11 display manager"; + homepage = https://github.com/sddm/sddm; + platforms = platforms.linux; + maintainers = with maintainers; [ abbradar ttuegel ]; + }; + }; + in -stdenv.mkDerivation rec { + +stdenv.mkDerivation { name = "sddm-${version}"; + phases = "installPhase"; - src = fetchFromGitHub { - owner = "sddm"; - repo = "sddm"; - rev = "v${version}"; - sha256 = "0c3q8lpb123m9k5x3i71mm8lmyzhknw77zxh89yfl8qmn6zd61i1"; - }; + nativeBuildInputs = [ lndir makeQtWrapper ]; + buildInputs = [ unwrapped ] ++ themes; + inherit themes; + inherit unwrapped; - patches = [ - ./0001-ignore-config-mtime.patch - ./0002-fix-ConfigReader-QStringList-corruption.patch - ]; + installPhase = '' + makeQtWrapper "$unwrapped/bin/sddm" "$out/bin/sddm" - nativeBuildInputs = [ cmake makeQtWrapper pkgconfig qttools ]; - - buildInputs = [ libxcb libpthreadstubs libXdmcp libXau qtbase qtdeclarative pam systemd ]; - - cmakeFlags = [ - "-DCONFIG_FILE=/etc/sddm.conf" - # Set UID_MIN and UID_MAX so that the build script won't try - # to read them from /etc/login.defs (fails in chroot). - # The values come from NixOS; they may not be appropriate - # for running SDDM outside NixOS, but that configuration is - # not supported anyway. - "-DUID_MIN=1000" - "-DUID_MAX=29999" - ]; - - preConfigure = '' - export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/lib/qt5/qml -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system" + mkdir -p "$out/share/sddm" + for pkg in $unwrapped $themes; do + local sddmDir="$pkg/share/sddm" + if [[ -d "$sddmDir" ]]; then + lndir -silent "$sddmDir" "$out/share/sddm" + fi + done ''; - postInstall = '' - wrapQtProgram $out/bin/sddm - wrapQtProgram $out/bin/sddm-greeter - ''; - - enableParallelBuilding = true; - - meta = with stdenv.lib; { - description = "QML based X11 display manager"; - homepage = https://github.com/sddm/sddm; - platforms = platforms.linux; - maintainers = with maintainers; [ abbradar ]; - }; + inherit (unwrapped) meta; } diff --git a/pkgs/desktops/plasma-5.5/breeze-gtk.nix b/pkgs/desktops/plasma-5.5/breeze-gtk.nix new file mode 100644 index 000000000000..179f15dc8763 --- /dev/null +++ b/pkgs/desktops/plasma-5.5/breeze-gtk.nix @@ -0,0 +1,8 @@ +{ plasmaPackage +, extra-cmake-modules +}: + +plasmaPackage { + name = "breeze-gtk"; + nativeBuildInputs = [ extra-cmake-modules ]; +} diff --git a/pkgs/desktops/plasma-5.5/default.nix b/pkgs/desktops/plasma-5.5/default.nix index 33937aa32200..812c70c2b004 100644 --- a/pkgs/desktops/plasma-5.5/default.nix +++ b/pkgs/desktops/plasma-5.5/default.nix @@ -44,11 +44,12 @@ let addPackages = self: with self; { bluedevil = callPackage ./bluedevil.nix {}; + breeze-gtk = callPackage ./breeze-gtk.nix {}; breeze-qt4 = callPackage ./breeze-qt4.nix {}; breeze-qt5 = callPackage ./breeze-qt5.nix {}; breeze = let version = (builtins.parseDrvName breeze-qt5.name).version; - in symlinkJoin "breeze-${version}" [ breeze-qt4 breeze-qt5 ]; + in symlinkJoin "breeze-${version}" [ breeze-gtk breeze-qt4 breeze-qt5 ]; kde-cli-tools = callPackage ./kde-cli-tools.nix {}; kde-gtk-config = callPackage ./kde-gtk-config {}; kdecoration = callPackage ./kdecoration.nix {}; diff --git a/pkgs/development/libraries/kde-frameworks-5.16/breeze-icons.nix b/pkgs/development/libraries/kde-frameworks-5.16/breeze-icons.nix new file mode 100644 index 000000000000..8c86a46401d5 --- /dev/null +++ b/pkgs/development/libraries/kde-frameworks-5.16/breeze-icons.nix @@ -0,0 +1,8 @@ +{ kdeFramework +, extra-cmake-modules +}: + +kdeFramework { + name = "breeze-icons"; + nativeBuildInputs = [ extra-cmake-modules ]; +} diff --git a/pkgs/development/libraries/kde-frameworks-5.16/default.nix b/pkgs/development/libraries/kde-frameworks-5.16/default.nix index 208a437c51e0..6c2889aa5981 100644 --- a/pkgs/development/libraries/kde-frameworks-5.16/default.nix +++ b/pkgs/development/libraries/kde-frameworks-5.16/default.nix @@ -40,6 +40,7 @@ let attica = callPackage ./attica.nix {}; baloo = callPackage ./baloo.nix {}; bluez-qt = callPackage ./bluez-qt.nix {}; + breeze-icons = callPackage ./breeze-icons.nix {}; extra-cmake-modules = callPackage ./extra-cmake-modules {}; frameworkintegration = callPackage ./frameworkintegration.nix {}; kactivities = callPackage ./kactivities.nix {}; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 89c9e0a3f503..c14fca4da545 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13114,7 +13114,9 @@ let printrun = callPackage ../applications/misc/printrun { }; - sddm = qt5Libs.callPackage ../applications/display-managers/sddm { }; + sddm = qt5Libs.callPackage ../applications/display-managers/sddm { + themes = []; # extra themes, etc. + }; slim = callPackage ../applications/display-managers/slim { libpng = libpng12;