From 456414c519af9523536c4a2c79e470eba751f33d Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 13 Nov 2016 09:19:26 -0600 Subject: [PATCH 1/8] installation-cd-graphical-kde: use KDE 5 --- .../cd-dvd/installation-cd-graphical-kde.nix | 86 ++++++------------- 1 file changed, 26 insertions(+), 60 deletions(-) diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix index b5ee57d9e22..5876aab93a7 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix @@ -1,20 +1,38 @@ # This module defines a NixOS installation CD that contains X11 and -# KDE 4. +# KDE 5. { config, lib, pkgs, ... }: with lib; { - imports = [ ./installation-cd-base.nix ../../profiles/graphical.nix ]; + imports = [ ./installation-cd-base.nix ]; - # Provide wicd for easy wireless configuration. - #networking.wicd.enable = true; + services.xserver = { + enable = true; + + # Automatically login as root. + displayManager.slim = { + enable = true; + defaultUser = "root"; + autoLogin = true; + }; + + desktopManager.kde5.enable = true; + + # Enable touchpad support for many laptops. + synaptics.enable = true; + }; environment.systemPackages = - [ # Include gparted for partitioning disks. + [ pkgs.glxinfo + + # Include gparted for partitioning disks. pkgs.gparted + # Firefox for reading the manual. + pkgs.firefox + # Include some editors. pkgs.vim pkgs.bvi # binary editor @@ -32,23 +50,12 @@ with lib; # Don't start the X server by default. services.xserver.autorun = mkForce false; - # Auto-login as root. - services.xserver.displayManager.kdm.extraConfig = - '' - [X-*-Core] - AllowRootLogin=true - AutoLoginEnable=true - AutoLoginUser=root - AutoLoginPass="" - ''; - # Custom kde-workspace adding some icons on the desktop - system.activationScripts.installerDesktop = let openManual = pkgs.writeScript "nixos-manual.sh" '' #!${pkgs.stdenv.shell} cd ${config.system.build.manual.manual}/share/doc/nixos/ - konqueror ./index.html + firefox ./index.html ''; desktopFile = pkgs.writeText "nixos-manual.desktop" '' @@ -57,55 +64,14 @@ with lib; Type=Application Name=NixOS Manual Exec=${openManual} - Icon=konqueror + Icon=firefox ''; in '' mkdir -p /root/Desktop ln -sfT ${desktopFile} /root/Desktop/nixos-manual.desktop - ln -sfT ${pkgs.kde4.konsole}/share/applications/kde4/konsole.desktop /root/Desktop/konsole.desktop + ln -sfT ${pkgs.kde5.konsole}/share/applications/org.kde.konsole.desktop /root/Desktop/org.kde.konsole.desktop ln -sfT ${pkgs.gparted}/share/applications/gparted.desktop /root/Desktop/gparted.desktop ''; - services.xserver.desktopManager.kde4.kdeWorkspacePackage = let - pkg = pkgs.kde4.kde_workspace; - - plasmaInit = pkgs.writeText "00-defaultLayout.js" '' - loadTemplate("org.kde.plasma-desktop.defaultPanel") - - for (var i = 0; i < screenCount; ++i) { - var desktop = new Activity - desktop.name = i18n("Desktop") - desktop.screen = i - desktop.wallpaperPlugin = 'image' - desktop.wallpaperMode = 'SingleImage' - - var folderview = desktop.addWidget("folderview"); - folderview.writeConfig("url", "desktop:/"); - - //Create more panels for other screens - if (i > 0){ - var panel = new Panel - panel.screen = i - panel.location = 'bottom' - panel.height = screenGeometry(i).height > 1024 ? 35 : 27 - var tasks = panel.addWidget("tasks") - tasks.writeConfig("showOnlyCurrentScreen", true); - } - } - ''; - - in - pkgs.runCommand pkg.name - { inherit (pkg) meta; } - '' - mkdir -p $out - cp -prf ${pkg}/* $out/ - chmod a+w $out/share/apps/plasma-desktop/init - cp -f ${plasmaInit} $out/share/apps/plasma-desktop/init/00-defaultLayout.js - ''; - - # Disable large stuff that's not very useful on the installation CD. - services.xserver.desktopManager.kde4.enablePIM = false; - } From dc598510aab4fb91c9ad5e2bb0bdba44a668add7 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 13 Nov 2016 12:33:38 -0600 Subject: [PATCH 2/8] kde5.plasma-desktop: display desktop folder by default Plasma 5 displays only a wallpaper on the desktop by default. I reason that if the user wants an empty desktop, they can make ~/Desktop empty. It's empty by default anyway. --- pkgs/desktops/kde-5/plasma/plasma-desktop/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/desktops/kde-5/plasma/plasma-desktop/default.nix b/pkgs/desktops/kde-5/plasma/plasma-desktop/default.nix index 7e8823e2db9..8d4098ca31f 100644 --- a/pkgs/desktops/kde-5/plasma/plasma-desktop/default.nix +++ b/pkgs/desktops/kde-5/plasma/plasma-desktop/default.nix @@ -38,4 +38,9 @@ plasmaPackage rec { "-DEvdev_INCLUDE_DIRS=${xf86inputevdev.dev}/include/xorg" "-DSynaptics_INCLUDE_DIRS=${xf86inputsynaptics.dev}/include/xorg" ]; + postInstall = '' + # Display ~/Desktop contents on the desktop by default. + sed -i "$out/share/plasma/shells/org.kde.plasma.desktop/contents/defaults" \ + -e 's/Containment=org.kde.desktopcontainment/Containment=org.kde.plasma.folder/' + ''; } From 87c4a20cb8be2559cc66297f1ad51738f2ed420b Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 13 Nov 2016 15:36:32 -0600 Subject: [PATCH 3/8] kde5.oxygen: use kdeWrapper instead of makeQtWrapper --- pkgs/desktops/kde-5/plasma/oxygen.nix | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/pkgs/desktops/kde-5/plasma/oxygen.nix b/pkgs/desktops/kde-5/plasma/oxygen.nix index 44a7575526f..f880f2e3ab2 100644 --- a/pkgs/desktops/kde-5/plasma/oxygen.nix +++ b/pkgs/desktops/kde-5/plasma/oxygen.nix @@ -1,19 +1,20 @@ { - plasmaPackage, - ecm, makeQtWrapper, + plasmaPackage, kdeWrapper, + ecm, frameworkintegration, kcmutils, kcompletion, kconfig, kdecoration, kguiaddons, ki18n, kwidgetsaddons, kservice, kwayland, kwindowsystem, qtx11extras }: -plasmaPackage { - name = "oxygen"; - nativeBuildInputs = [ ecm makeQtWrapper ]; - propagatedBuildInputs = [ - frameworkintegration kcmutils kcompletion kconfig kdecoration kguiaddons - ki18n kservice kwayland kwidgetsaddons kwindowsystem qtx11extras - ]; - postInstall = '' - wrapQtProgram "$out/bin/oxygen-demo5" - wrapQtProgram "$out/bin/oxygen-settings5" - ''; +let + unwrapped = plasmaPackage { + name = "oxygen"; + nativeBuildInputs = [ ecm ]; + propagatedBuildInputs = [ + frameworkintegration kcmutils kcompletion kconfig kdecoration kguiaddons + ki18n kservice kwayland kwidgetsaddons kwindowsystem qtx11extras + ]; + }; +in +kdeWrapper unwrapped { + targets = [ "bin/oxygen-demo5" "bin/oxygen-settings5" ]; } From c9146d7e5f253c65d7c422ce2c7ee2a12261f83b Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Mon, 14 Nov 2016 09:48:05 -0600 Subject: [PATCH 4/8] kde5: don't install oxygen-icons5 if breeze-icons is present --- nixos/modules/services/x11/desktop-managers/kde5.nix | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/nixos/modules/services/x11/desktop-managers/kde5.nix b/nixos/modules/services/x11/desktop-managers/kde5.nix index bc010d1ce1c..07f6a402e81 100644 --- a/nixos/modules/services/x11/desktop-managers/kde5.nix +++ b/nixos/modules/services/x11/desktop-managers/kde5.nix @@ -141,13 +141,12 @@ in kde5.konsole kde5.print-manager - # Oxygen icons moved to KDE Frameworks 5.16 and later. - (kde5.oxygen-icons or kde5.oxygen-icons5) + # Install Breeze icons if available + (kde5.breeze-icons or kde5.oxygen-icons5 or kde5.oxygen-icons) pkgs.hicolor_icon_theme - kde5.kde-gtk-config + kde5.kde-gtk-config kde5.breeze-gtk - pkgs.phonon-backend-gstreamer pkgs.qt5.phonon-backend-gstreamer ] @@ -155,9 +154,6 @@ in # If it is not available, Orion is very similar to Breeze. ++ lib.optional (!(lib.hasAttr "breeze-gtk" kde5)) pkgs.orion - # Install Breeze icons if available - ++ lib.optional (lib.hasAttr "breeze-icons" kde5) kde5.breeze-icons - # Install activity manager if available ++ lib.optional (lib.hasAttr "kactivitymanagerd" kde5) kde5.kactivitymanagerd @@ -217,7 +213,6 @@ in kde5.ecm # for the setup-hook kde5.plasma-workspace kde5.breeze-icons - (kde5.oxygen-icons or kde5.oxygen-icons5) ]; }; From 8c3aa5a484b66dcf00365253e59d012976e03714 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Mon, 14 Nov 2016 09:59:22 -0600 Subject: [PATCH 5/8] kde5: add enableQt4Support option --- .../cd-dvd/installation-cd-graphical-kde.nix | 5 ++++- .../modules/services/x11/desktop-managers/kde5.nix | 13 ++++++++++++- pkgs/desktops/kde-5/plasma/default.nix | 8 -------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix index 5876aab93a7..bf233e24797 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix @@ -18,7 +18,10 @@ with lib; autoLogin = true; }; - desktopManager.kde5.enable = true; + desktopManager.kde5 = { + enable = true; + enableQt4Support = false; + }; # Enable touchpad support for many laptops. synaptics.enable = true; diff --git a/nixos/modules/services/x11/desktop-managers/kde5.nix b/nixos/modules/services/x11/desktop-managers/kde5.nix index 07f6a402e81..9b51b92faa4 100644 --- a/nixos/modules/services/x11/desktop-managers/kde5.nix +++ b/nixos/modules/services/x11/desktop-managers/kde5.nix @@ -22,6 +22,15 @@ in description = "Enable the Plasma 5 (KDE 5) desktop environment."; }; + enableQt4Support = mkOption { + type = types.bool; + default = true; + description = '' + Enable support for Qt 4-based applications. Particularly, install the + Qt 4 version of the Breeze theme and a default backend for Phonon. + ''; + }; + }; }; @@ -105,7 +114,7 @@ in kde5.sonnet kde5.threadweaver - kde5.breeze + kde5.breeze-qt5 kde5.kactivitymanagerd kde5.kde-cli-tools kde5.kdecoration @@ -160,6 +169,8 @@ in # frameworkintegration was split with plasma-integration in Plasma 5.6 ++ lib.optional (lib.hasAttr "plasma-integration" kde5) kde5.plasma-integration + ++ lib.optionals cfg.enableQt4Support [ kde5.breeze-qt4 pkgs.phonon-backend-gstreamer ] + # Optional hardware support features ++ lib.optional config.hardware.bluetooth.enable kde5.bluedevil ++ lib.optional config.networking.networkmanager.enable kde5.plasma-nm diff --git a/pkgs/desktops/kde-5/plasma/default.nix b/pkgs/desktops/kde-5/plasma/default.nix index bb123fcdab4..36850824d63 100644 --- a/pkgs/desktops/kde-5/plasma/default.nix +++ b/pkgs/desktops/kde-5/plasma/default.nix @@ -44,14 +44,6 @@ let inherit (srcs.breeze) src version; }; breeze-qt5 = callPackage ./breeze-qt5.nix {}; - breeze = - let - version = (builtins.parseDrvName breeze-qt5.name).version; - in - symlinkJoin { - name = "breeze-${version}"; - paths = map (pkg: pkg.out or pkg) [ breeze-gtk breeze-qt4 breeze-qt5 ]; - }; breeze-grub = callPackage ./breeze-grub.nix {}; breeze-plymouth = callPackage ./breeze-plymouth {}; kactivitymanagerd = callPackage ./kactivitymanagerd.nix {}; From 66d9772f0b79d4999b9f032f720d87ea7682377f Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Mon, 14 Nov 2016 17:52:50 -0600 Subject: [PATCH 6/8] installation-cd-graphical-kde: put manual link directly on desktop --- .../cd-dvd/installation-cd-graphical-kde.nix | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix index bf233e24797..c44dff3bb60 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix @@ -53,21 +53,14 @@ with lib; # Don't start the X server by default. services.xserver.autorun = mkForce false; - # Custom kde-workspace adding some icons on the desktop system.activationScripts.installerDesktop = let - openManual = pkgs.writeScript "nixos-manual.sh" '' - #!${pkgs.stdenv.shell} - cd ${config.system.build.manual.manual}/share/doc/nixos/ - firefox ./index.html - ''; - desktopFile = pkgs.writeText "nixos-manual.desktop" '' [Desktop Entry] Version=1.0 Type=Application Name=NixOS Manual - Exec=${openManual} - Icon=firefox + Exec=firefox ${config.system.build.manual.manual}/share/doc/nixos/index.html + Icon=text-html ''; in '' From 7397dabc981eacb6069c447a8c56739846c84ee7 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Mon, 14 Nov 2016 18:02:09 -0600 Subject: [PATCH 7/8] startkde: install default GTK config if needed --- .../kde-5/plasma/startkde/startkde.sh | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pkgs/desktops/kde-5/plasma/startkde/startkde.sh b/pkgs/desktops/kde-5/plasma/startkde/startkde.sh index 256f9949e83..d3b460f966b 100755 --- a/pkgs/desktops/kde-5/plasma/startkde/startkde.sh +++ b/pkgs/desktops/kde-5/plasma/startkde/startkde.sh @@ -6,6 +6,34 @@ export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}@QT_PLUGIN_PATH@" export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}@QML_IMPORT_PATH@" export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}@QML2_IMPORT_PATH@" +# Set the default GTK 2 theme +if [ ! -e $HOME/.gtkrc-2.0 -a -e /run/current-system/sw/share/themes/Breeze/gtk-2.0/gtkrc ]; then + cat >$HOME/.gtkrc-2.0 <$HOME/.config/gtk-3.0/settings.ini < Date: Mon, 14 Nov 2016 21:07:26 -0600 Subject: [PATCH 8/8] startkde: initialize kcminputrc if missing --- pkgs/desktops/kde-5/plasma/startkde/startkde.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pkgs/desktops/kde-5/plasma/startkde/startkde.sh b/pkgs/desktops/kde-5/plasma/startkde/startkde.sh index d3b460f966b..63c62f12321 100755 --- a/pkgs/desktops/kde-5/plasma/startkde/startkde.sh +++ b/pkgs/desktops/kde-5/plasma/startkde/startkde.sh @@ -7,7 +7,8 @@ export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}@QML_IMPORT_PATH@" export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}@QML2_IMPORT_PATH@" # Set the default GTK 2 theme -if [ ! -e $HOME/.gtkrc-2.0 -a -e /run/current-system/sw/share/themes/Breeze/gtk-2.0/gtkrc ]; then +if ! [ -e $HOME/.gtkrc-2.0 ] \ + && [ -e /run/current-system/sw/share/themes/Breeze/gtk-2.0/gtkrc ]; then cat >$HOME/.gtkrc-2.0 <$HOME/.config/gtk-3.0/settings.ini <$configDir/kcminputrc <