Merge pull request #21466 from abbradar/kde-wrapper

Flatten nested kdeWrappers

authored by Thomas Tuegel and committed by GitHub 0723aa81 c6ec873a

+293 -219
+185 -166
nixos/modules/services/x11/desktop-managers/kde5.nix
··· 31 ''; 32 }; 33 34 }; 35 36 }; 37 38 39 - config = mkIf (xcfg.enable && cfg.enable) { 40 41 - warnings = optional config.services.xserver.desktopManager.kde4.enable 42 - "KDE 4 should not be enabled at the same time as KDE 5"; 43 44 - services.xserver.desktopManager.session = singleton { 45 - name = "kde5"; 46 - bgSupport = true; 47 - start = '' 48 - # Load PulseAudio module for routing support. 49 - # See http://colin.guthr.ie/2009/10/so-how-does-the-kde-pulseaudio-support-work-anyway/ 50 - ${optionalString config.hardware.pulseaudio.enable '' 51 - ${getBin config.hardware.pulseaudio.package}/bin/pactl load-module module-device-manager "do_routing=1" 52 - ''} 53 54 - exec "${kde5.startkde}" 55 56 - ''; 57 - }; 58 59 - security.setuidOwners = [ 60 - { 61 - program = "kcheckpass"; 62 - source = "${kde5.plasma-workspace.out}/lib/libexec/kcheckpass"; 63 - owner = "root"; 64 - setuid = true; 65 - } 66 - { 67 - program = "start_kdeinit"; 68 - source = "${kde5.kinit.out}/lib/libexec/kf5/start_kdeinit"; 69 - owner = "root"; 70 - setuid = true; 71 - } 72 - ]; 73 74 - environment.systemPackages = 75 - [ 76 - kde5.frameworkintegration 77 - kde5.kactivities 78 - kde5.kauth 79 - kde5.kcmutils 80 - kde5.kconfig 81 - kde5.kconfigwidgets 82 - kde5.kcoreaddons 83 - kde5.kdbusaddons 84 - kde5.kdeclarative 85 - kde5.kded 86 - kde5.kdesu 87 - kde5.kdnssd 88 - kde5.kemoticons 89 - kde5.kfilemetadata 90 - kde5.kglobalaccel 91 - kde5.kguiaddons 92 - kde5.kiconthemes 93 - kde5.kidletime 94 - kde5.kimageformats 95 - kde5.kinit 96 - kde5.kio 97 - kde5.kjobwidgets 98 - kde5.knewstuff 99 - kde5.knotifications 100 - kde5.knotifyconfig 101 - kde5.kpackage 102 - kde5.kparts 103 - kde5.kpeople 104 - kde5.krunner 105 - kde5.kservice 106 - kde5.ktextwidgets 107 - kde5.kwallet 108 - kde5.kwayland 109 - kde5.kwidgetsaddons 110 - kde5.kxmlgui 111 - kde5.kxmlrpcclient 112 - kde5.plasma-framework 113 - kde5.solid 114 - kde5.sonnet 115 - kde5.threadweaver 116 117 - kde5.breeze-qt5 118 - kde5.kactivitymanagerd 119 - kde5.kde-cli-tools 120 - kde5.kdecoration 121 - kde5.kdeplasma-addons 122 - kde5.kgamma5 123 - kde5.khelpcenter 124 - kde5.khotkeys 125 - kde5.kinfocenter 126 - kde5.kmenuedit 127 - kde5.kscreen 128 - kde5.kscreenlocker 129 - kde5.ksysguard 130 - kde5.kwayland 131 - kde5.kwin 132 - kde5.kwrited 133 - kde5.libkscreen 134 - kde5.libksysguard 135 - kde5.milou 136 - kde5.oxygen 137 - kde5.plasma-integration 138 - kde5.polkit-kde-agent 139 - kde5.systemsettings 140 141 - kde5.plasma-desktop 142 - kde5.plasma-workspace 143 - kde5.plasma-workspace-wallpapers 144 145 - kde5.dolphin 146 - kde5.dolphin-plugins 147 - kde5.ffmpegthumbs 148 - kde5.kdegraphics-thumbnailers 149 - kde5.kio-extras 150 - kde5.konsole 151 - kde5.print-manager 152 153 - # Install Breeze icons if available 154 - (kde5.breeze-icons or kde5.oxygen-icons5 or kde5.oxygen-icons) 155 - pkgs.hicolor_icon_theme 156 157 - kde5.kde-gtk-config kde5.breeze-gtk 158 159 - pkgs.qt5.phonon-backend-gstreamer 160 - ] 161 162 - # Plasma 5.5 and later has a Breeze GTK theme. 163 - # If it is not available, Orion is very similar to Breeze. 164 - ++ lib.optional (!(lib.hasAttr "breeze-gtk" kde5)) pkgs.orion 165 166 - # Install activity manager if available 167 - ++ lib.optional (lib.hasAttr "kactivitymanagerd" kde5) kde5.kactivitymanagerd 168 169 - # frameworkintegration was split with plasma-integration in Plasma 5.6 170 - ++ lib.optional (lib.hasAttr "plasma-integration" kde5) kde5.plasma-integration 171 172 - ++ lib.optionals cfg.enableQt4Support [ kde5.breeze-qt4 pkgs.phonon-backend-gstreamer ] 173 174 - # Optional hardware support features 175 - ++ lib.optional config.hardware.bluetooth.enable kde5.bluedevil 176 - ++ lib.optional config.networking.networkmanager.enable kde5.plasma-nm 177 - ++ lib.optional config.hardware.pulseaudio.enable kde5.plasma-pa 178 - ++ lib.optional config.powerManagement.enable kde5.powerdevil 179 - ++ lib.optional config.services.colord.enable pkgs.colord-kde 180 - ++ lib.optionals config.services.samba.enable [ kde5.kdenetwork-filesharing pkgs.samba ]; 181 182 - environment.pathsToLink = [ "/share" ]; 183 184 - environment.etc = singleton { 185 - source = "${pkgs.xkeyboard_config}/etc/X11/xkb"; 186 - target = "X11/xkb"; 187 - }; 188 189 - # Enable GTK applications to load SVG icons 190 - environment.variables = 191 - { 192 - GST_PLUGIN_SYSTEM_PATH_1_0 = 193 - lib.makeSearchPath "/lib/gstreamer-1.0" 194 - (builtins.map (pkg: pkg.out) (with pkgs.gst_all_1; [ 195 - gstreamer 196 - gst-plugins-base 197 - gst-plugins-good 198 - gst-plugins-ugly 199 - gst-plugins-bad 200 - gst-libav # for mp3 playback 201 - ])); 202 - } 203 - // (if (lib.hasAttr "breeze-icons" kde5) 204 - then { GDK_PIXBUF_MODULE_FILE = "${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"; } 205 - else { }); 206 207 - fonts.fonts = [ (kde5.oxygen-fonts or pkgs.noto-fonts) ]; 208 209 - programs.ssh.askPassword = "${kde5.ksshaskpass.out}/bin/ksshaskpass"; 210 211 - # Enable helpful DBus services. 212 - services.udisks2.enable = true; 213 - services.upower.enable = config.powerManagement.enable; 214 215 - # Extra UDEV rules used by Solid 216 - services.udev.packages = [ 217 - pkgs.libmtp 218 - pkgs.media-player-info 219 - ]; 220 221 - services.xserver.displayManager.sddm = { 222 - theme = "breeze"; 223 - themes = [ 224 - kde5.ecm # for the setup-hook 225 - kde5.plasma-workspace 226 - kde5.breeze-icons 227 ]; 228 - }; 229 230 - security.pam.services.kde = { allowNullPassword = true; }; 231 232 - }; 233 234 }
··· 31 ''; 32 }; 33 34 + extraPackages = mkOption { 35 + type = types.listOf types.package; 36 + default = []; 37 + description = '' 38 + KDE packages that need to be installed system-wide. 39 + ''; 40 + }; 41 + 42 }; 43 44 }; 45 46 47 + config = mkMerge [ 48 + (mkIf (cfg.extraPackages != []) { 49 + environment.systemPackages = [ (kde5.kdeWrapper cfg.extraPackages) ]; 50 + }) 51 52 + (mkIf (xcfg.enable && cfg.enable) { 53 54 + warnings = optional config.services.xserver.desktopManager.kde4.enable 55 + "KDE 4 should not be enabled at the same time as KDE 5"; 56 57 + services.xserver.desktopManager.session = singleton { 58 + name = "kde5"; 59 + bgSupport = true; 60 + start = '' 61 + # Load PulseAudio module for routing support. 62 + # See http://colin.guthr.ie/2009/10/so-how-does-the-kde-pulseaudio-support-work-anyway/ 63 + ${optionalString config.hardware.pulseaudio.enable '' 64 + ${getBin config.hardware.pulseaudio.package}/bin/pactl load-module module-device-manager "do_routing=1" 65 + ''} 66 67 + exec "${kde5.startkde}" 68 69 + ''; 70 + }; 71 72 + security.setuidOwners = [ 73 + { 74 + program = "kcheckpass"; 75 + source = "${kde5.plasma-workspace.out}/lib/libexec/kcheckpass"; 76 + owner = "root"; 77 + setuid = true; 78 + } 79 + { 80 + program = "start_kdeinit"; 81 + source = "${kde5.kinit.out}/lib/libexec/kf5/start_kdeinit"; 82 + owner = "root"; 83 + setuid = true; 84 + } 85 + ]; 86 + 87 + environment.systemPackages = 88 + [ 89 + kde5.frameworkintegration 90 + kde5.kactivities 91 + kde5.kauth 92 + kde5.kcmutils 93 + kde5.kconfig 94 + kde5.kconfigwidgets 95 + kde5.kcoreaddons 96 + kde5.kdbusaddons 97 + kde5.kdeclarative 98 + kde5.kded 99 + kde5.kdesu 100 + kde5.kdnssd 101 + kde5.kemoticons 102 + kde5.kfilemetadata 103 + kde5.kglobalaccel 104 + kde5.kguiaddons 105 + kde5.kiconthemes 106 + kde5.kidletime 107 + kde5.kimageformats 108 + kde5.kinit 109 + kde5.kio 110 + kde5.kjobwidgets 111 + kde5.knewstuff 112 + kde5.knotifications 113 + kde5.knotifyconfig 114 + kde5.kpackage 115 + kde5.kparts 116 + kde5.kpeople 117 + kde5.krunner 118 + kde5.kservice 119 + kde5.ktextwidgets 120 + kde5.kwallet 121 + kde5.kwayland 122 + kde5.kwidgetsaddons 123 + kde5.kxmlgui 124 + kde5.kxmlrpcclient 125 + kde5.plasma-framework 126 + kde5.solid 127 + kde5.sonnet 128 + kde5.threadweaver 129 + 130 + kde5.breeze-qt5 131 + kde5.kactivitymanagerd 132 + kde5.kde-cli-tools 133 + kde5.kdecoration 134 + kde5.kdeplasma-addons 135 + kde5.kgamma5 136 + kde5.khotkeys 137 + kde5.kinfocenter 138 + kde5.kmenuedit 139 + kde5.kscreen 140 + kde5.kscreenlocker 141 + kde5.ksysguard 142 + kde5.kwayland 143 + kde5.kwin 144 + kde5.kwrited 145 + kde5.libkscreen 146 + kde5.libksysguard 147 + kde5.milou 148 + kde5.plasma-integration 149 + kde5.polkit-kde-agent 150 + kde5.systemsettings 151 152 + kde5.plasma-desktop 153 + kde5.plasma-workspace 154 + kde5.plasma-workspace-wallpapers 155 156 + kde5.dolphin-plugins 157 + kde5.ffmpegthumbs 158 + kde5.kdegraphics-thumbnailers 159 + kde5.kio-extras 160 + kde5.print-manager 161 162 + # Install Breeze icons if available 163 + (kde5.breeze-icons or kde5.oxygen-icons5 or kde5.oxygen-icons) 164 + pkgs.hicolor_icon_theme 165 166 + kde5.kde-gtk-config kde5.breeze-gtk 167 168 + pkgs.qt5.phonon-backend-gstreamer 169 + ] 170 171 + # Plasma 5.5 and later has a Breeze GTK theme. 172 + # If it is not available, Orion is very similar to Breeze. 173 + ++ lib.optional (!(lib.hasAttr "breeze-gtk" kde5)) pkgs.orion 174 175 + # Install activity manager if available 176 + ++ lib.optional (lib.hasAttr "kactivitymanagerd" kde5) kde5.kactivitymanagerd 177 178 + # frameworkintegration was split with plasma-integration in Plasma 5.6 179 + ++ lib.optional (lib.hasAttr "plasma-integration" kde5) kde5.plasma-integration 180 181 + ++ lib.optionals cfg.enableQt4Support [ kde5.breeze-qt4 pkgs.phonon-backend-gstreamer ] 182 183 + # Optional hardware support features 184 + ++ lib.optional config.hardware.bluetooth.enable kde5.bluedevil 185 + ++ lib.optional config.networking.networkmanager.enable kde5.plasma-nm 186 + ++ lib.optional config.hardware.pulseaudio.enable kde5.plasma-pa 187 + ++ lib.optional config.powerManagement.enable kde5.powerdevil 188 + ++ lib.optional config.services.colord.enable pkgs.colord-kde 189 + ++ lib.optionals config.services.samba.enable [ kde5.kdenetwork-filesharing pkgs.samba ]; 190 191 + services.xserver.desktopManager.kde5.extraPackages = 192 + [ 193 + kde5.khelpcenter 194 + kde5.oxygen 195 196 + kde5.dolphin 197 + kde5.konsole 198 + ]; 199 200 + environment.pathsToLink = [ "/share" ]; 201 202 + environment.etc = singleton { 203 + source = "${pkgs.xkeyboard_config}/etc/X11/xkb"; 204 + target = "X11/xkb"; 205 + }; 206 207 + environment.variables = 208 + { 209 + # Enable GTK applications to load SVG icons 210 + GST_PLUGIN_SYSTEM_PATH_1_0 = 211 + lib.makeSearchPath "/lib/gstreamer-1.0" 212 + (builtins.map (pkg: pkg.out) (with pkgs.gst_all_1; [ 213 + gstreamer 214 + gst-plugins-base 215 + gst-plugins-good 216 + gst-plugins-ugly 217 + gst-plugins-bad 218 + gst-libav # for mp3 playback 219 + ])); 220 + } 221 + // (if (lib.hasAttr "breeze-icons" kde5) 222 + then { GDK_PIXBUF_MODULE_FILE = "${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"; } 223 + else { }); 224 225 + fonts.fonts = [ (kde5.oxygen-fonts or pkgs.noto-fonts) ]; 226 227 + programs.ssh.askPassword = "${kde5.ksshaskpass.out}/bin/ksshaskpass"; 228 229 + # Enable helpful DBus services. 230 + services.udisks2.enable = true; 231 + services.upower.enable = config.powerManagement.enable; 232 233 + # Extra UDEV rules used by Solid 234 + services.udev.packages = [ 235 + pkgs.libmtp 236 + pkgs.media-player-info 237 ]; 238 + 239 + services.xserver.displayManager.sddm = { 240 + theme = "breeze"; 241 + themes = [ 242 + kde5.ecm # for the setup-hook 243 + kde5.plasma-workspace 244 + kde5.breeze-icons 245 + ]; 246 + }; 247 248 + security.pam.services.kde = { allowNullPassword = true; }; 249 250 + }) 251 + ]; 252 253 }
+2 -1
pkgs/applications/editors/kile/frameworks.nix
··· 60 }; 61 }; 62 in 63 - kdeWrapper unwrapped 64 { 65 targets = [ "bin/kile" ]; 66 paths = [ konsole.unwrapped ]; 67 }
··· 60 }; 61 }; 62 in 63 + kdeWrapper 64 { 65 + inherit unwrapped; 66 targets = [ "bin/kile" ]; 67 paths = [ konsole.unwrapped ]; 68 }
+2 -2
pkgs/applications/misc/yakuake/3.0.nix
··· 55 56 57 in 58 - kdeWrapper unwrapped 59 { 60 targets = [ "bin/yakuake" ]; 61 paths = [ konsole.unwrapped ]; 62 } 63 -
··· 55 56 57 in 58 + kdeWrapper 59 { 60 + inherit unwrapped; 61 targets = [ "bin/yakuake" ]; 62 paths = [ konsole.unwrapped ]; 63 }
+2 -1
pkgs/applications/networking/irc/konversation/1.6.nix
··· 75 homepage = https://konversation.kde.org; 76 }; 77 }; 78 - in kdeWrapper unwrapped { 79 targets = [ "bin/konversation" ]; 80 } 81
··· 75 homepage = https://konversation.kde.org; 76 }; 77 }; 78 + in kdeWrapper { 79 + inherit unwrapped; 80 targets = [ "bin/konversation" ]; 81 } 82
+2 -1
pkgs/desktops/kde-5/applications/ark/default.nix
··· 36 }; 37 }; 38 in 39 - kdeWrapper unwrapped 40 { 41 targets = [ "bin/ark" ]; 42 }
··· 36 }; 37 }; 38 in 39 + kdeWrapper 40 { 41 + inherit unwrapped; 42 targets = [ "bin/ark" ]; 43 }
+2 -1
pkgs/desktops/kde-5/applications/dolphin.nix
··· 24 ]; 25 }; 26 in 27 - kdeWrapper unwrapped 28 { 29 targets = [ "bin/dolphin" ]; 30 paths = [ dolphin-plugins konsole.unwrapped ]; 31 }
··· 24 ]; 25 }; 26 in 27 + kdeWrapper 28 { 29 + inherit unwrapped; 30 targets = [ "bin/dolphin" ]; 31 paths = [ dolphin-plugins konsole.unwrapped ]; 32 }
+4 -1
pkgs/desktops/kde-5/applications/filelight.nix
··· 18 ]; 19 }; 20 in 21 - kdeWrapper unwrapped { targets = [ "bin/filelight" ]; }
··· 18 ]; 19 }; 20 in 21 + kdeWrapper { 22 + inherit unwrapped; 23 + targets = [ "bin/filelight" ]; 24 + }
+2 -1
pkgs/desktops/kde-5/applications/gwenview.nix
··· 20 ]; 21 }; 22 in 23 - kdeWrapper unwrapped { 24 targets = [ "bin/gwenview" ]; 25 paths = [ kipi-plugins ]; 26 }
··· 20 ]; 21 }; 22 in 23 + kdeWrapper { 24 + inherit unwrapped; 25 targets = [ "bin/gwenview" ]; 26 paths = [ kipi-plugins ]; 27 }
+2 -1
pkgs/desktops/kde-5/applications/kate.nix
··· 24 ]; 25 }; 26 in 27 - kdeWrapper unwrapped 28 { 29 targets = [ "bin/kate" "bin/kwrite" ]; 30 paths = [ konsole.unwrapped ]; 31 }
··· 24 ]; 25 }; 26 in 27 + kdeWrapper 28 { 29 + inherit unwrapped; 30 targets = [ "bin/kate" "bin/kwrite" ]; 31 paths = [ konsole.unwrapped ]; 32 }
+4 -1
pkgs/desktops/kde-5/applications/kcalc.nix
··· 18 ]; 19 }; 20 in 21 - kdeWrapper unwrapped { targets = [ "bin/kcalc" ]; }
··· 18 ]; 19 }; 20 in 21 + kdeWrapper { 22 + inherit unwrapped; 23 + targets = [ "bin/kcalc" ]; 24 + }
+4 -1
pkgs/desktops/kde-5/applications/kcolorchooser.nix
··· 15 propagatedBuildInputs = [ ki18n kwidgetsaddons kxmlgui ]; 16 }; 17 in 18 - kdeWrapper unwrapped { targets = [ "bin/kcolorchooser" ]; }
··· 15 propagatedBuildInputs = [ ki18n kwidgetsaddons kxmlgui ]; 16 }; 17 in 18 + kdeWrapper { 19 + inherit unwrapped; 20 + targets = [ "bin/kcolorchooser" ]; 21 + }
+2 -1
pkgs/desktops/kde-5/applications/kdenlive.nix
··· 74 }; 75 }; 76 in 77 - kdeWrapper unwrapped 78 { 79 targets = [ "bin/kdenlive" ]; 80 paths = [ kinit ]; 81 }
··· 74 }; 75 }; 76 in 77 + kdeWrapper 78 { 79 + inherit unwrapped; 80 targets = [ "bin/kdenlive" ]; 81 paths = [ kinit ]; 82 }
+4 -1
pkgs/desktops/kde-5/applications/kdf.nix
··· 18 ]; 19 }; 20 in 21 - kdeWrapper unwrapped { targets = [ "bin/kdf" ]; }
··· 18 ]; 19 }; 20 in 21 + kdeWrapper { 22 + inherit unwrapped; 23 + targets = [ "bin/kdf" ]; 24 + }
+4 -1
pkgs/desktops/kde-5/applications/khelpcenter.nix
··· 16 ]; 17 }; 18 in 19 - kdeWrapper unwrapped { targets = [ "bin/khelpcenter" ]; }
··· 16 ]; 17 }; 18 in 19 + kdeWrapper { 20 + inherit unwrapped; 21 + targets = [ "bin/khelpcenter" ]; 22 + }
+4 -1
pkgs/desktops/kde-5/applications/kompare.nix
··· 15 ]; 16 }; 17 in 18 - kdeWrapper unwrapped { targets = [ "bin/kompare" ]; }
··· 15 ]; 16 }; 17 in 18 + kdeWrapper { 19 + inherit unwrapped; 20 + targets = [ "bin/kompare" ]; 21 + }
+4 -1
pkgs/desktops/kde-5/applications/konsole.nix
··· 24 ]; 25 }; 26 in 27 - kdeWrapper unwrapped { targets = [ "bin/konsole" ]; }
··· 24 ]; 25 }; 26 in 27 + kdeWrapper { 28 + inherit unwrapped; 29 + targets = [ "bin/konsole" ]; 30 + }
+2 -1
pkgs/desktops/kde-5/applications/kwalletmanager.nix
··· 30 kxmlgui 31 ]; 32 }; 33 - in kdeWrapper unwrapped { 34 targets = ["bin/kwalletmanager5"]; 35 }
··· 30 kxmlgui 31 ]; 32 }; 33 + in kdeWrapper { 34 + inherit unwrapped; 35 targets = ["bin/kwalletmanager5"]; 36 }
+2 -1
pkgs/desktops/kde-5/applications/marble.nix
··· 18 enableParallelBuilding = true; 19 }; 20 in 21 - kdeWrapper unwrapped { 22 targets = [ "bin/marble-qt" ]; 23 paths = [ unwrapped ]; 24 }
··· 18 enableParallelBuilding = true; 19 }; 20 in 21 + kdeWrapper { 22 + inherit unwrapped; 23 targets = [ "bin/marble-qt" ]; 24 paths = [ unwrapped ]; 25 }
+2 -1
pkgs/desktops/kde-5/applications/okular.nix
··· 25 }; 26 }; 27 in 28 - kdeWrapper unwrapped { 29 targets = [ "bin/okular" ]; 30 }
··· 25 }; 26 }; 27 in 28 + kdeWrapper { 29 + inherit unwrapped; 30 targets = [ "bin/okular" ]; 31 }
+2 -1
pkgs/desktops/kde-5/applications/spectacle.nix
··· 18 ]; 19 }; 20 in 21 - kdeWrapper unwrapped { 22 targets = [ "bin/spectacle" ]; 23 paths = [ kipi-plugins ]; 24 }
··· 18 ]; 19 }; 20 in 21 + kdeWrapper { 22 + inherit unwrapped; 23 targets = [ "bin/spectacle" ]; 24 paths = [ kipi-plugins ]; 25 }
+2 -1
pkgs/desktops/kde-5/plasma/oxygen.nix
··· 15 ]; 16 }; 17 in 18 - kdeWrapper unwrapped { 19 targets = [ "bin/oxygen-demo5" "bin/oxygen-settings5" ]; 20 }
··· 15 ]; 16 }; 17 in 18 + kdeWrapper { 19 + inherit unwrapped; 20 targets = [ "bin/oxygen-demo5" "bin/oxygen-settings5" ]; 21 }
+50 -30
pkgs/development/libraries/kde-frameworks/kde-wrapper.nix
··· 1 { stdenv, lib, makeWrapper, buildEnv }: 2 3 - drv: 4 - 5 - { targets, paths ? [] }: 6 7 let 8 env = buildEnv { 9 - inherit (drv) name meta; 10 - paths = builtins.map lib.getBin ([drv] ++ paths); 11 pathsToLink = [ "/bin" "/share" "/lib/qt5" "/etc/xdg" ]; 12 }; 13 in 14 15 stdenv.mkDerivation { 16 - inherit (drv) name meta; 17 preferLocalBuild = true; 18 19 - paths = builtins.map lib.getBin ([drv] ++ paths); 20 - inherit drv env targets; 21 - passthru = { unwrapped = drv; }; 22 23 - nativeBuildInputs = [ makeWrapper ]; 24 25 - builder = builtins.toFile "builder.sh" '' 26 - . $stdenv/setup 27 28 for t in $targets; do 29 - if [ -a "$drv/$t" ]; then 30 - makeWrapper "$drv/$t" "$out/$t" \ 31 - --argv0 '"$0"' \ 32 - --suffix PATH : "$env/bin" \ 33 - --prefix XDG_CONFIG_DIRS : "$env/share" \ 34 - --prefix XDG_DATA_DIRS : "$env/etc/xdg" \ 35 - --set QML_IMPORT_PATH "$env/lib/qt5/imports" \ 36 - --set QML2_IMPORT_PATH "$env/lib/qt5/qml" \ 37 - --set QT_PLUGIN_PATH "$env/lib/qt5/plugins" 38 - else 39 - echo "no such file or directory: $drv/$t" 40 exit 1 41 fi 42 done 43 44 - if [ -a "$drv/share" ]; then 45 - ln -s "$drv/share" "$out" 46 - fi 47 48 - if [ -a "$drv/nix-support/propagated-user-env-packages" ]; then 49 - mkdir -p "$out/nix-support" 50 - ln -s "$drv/nix-support/propagated-user-env-packages" "$out/nix-support/" 51 - fi 52 ''; 53 }
··· 1 { stdenv, lib, makeWrapper, buildEnv }: 2 3 + packages: 4 5 let 6 + packages_ = if builtins.isList packages then packages else [packages]; 7 + 8 + unwrapped = lib.concatMap (p: if builtins.isList p.unwrapped then p.unwrapped else [p.unwrapped]) packages_; 9 + targets = lib.concatMap (p: p.targets) packages_; 10 + paths = lib.concatMap (p: p.paths or []) packages_; 11 + 12 + name = 13 + if builtins.length unwrapped == 1 14 + then (lib.head unwrapped).name 15 + else "kde-application"; 16 + meta = 17 + if builtins.length unwrapped == 1 18 + then (lib.head unwrapped).meta 19 + else {}; 20 + 21 env = buildEnv { 22 + inherit name meta; 23 + paths = builtins.map lib.getBin (unwrapped ++ paths); 24 pathsToLink = [ "/bin" "/share" "/lib/qt5" "/etc/xdg" ]; 25 }; 26 in 27 28 stdenv.mkDerivation { 29 + inherit name meta; 30 preferLocalBuild = true; 31 32 + inherit unwrapped env targets; 33 34 + passthru = { 35 + inherit targets paths; 36 + unwrapped = if builtins.length unwrapped == 1 then lib.head unwrapped else unwrapped; 37 + }; 38 39 + nativeBuildInputs = [ makeWrapper ]; 40 41 + buildCommand = '' 42 for t in $targets; do 43 + good="" 44 + for drv in $unwrapped; do 45 + if [ -a "$drv/$t" ]; then 46 + makeWrapper "$drv/$t" "$out/$t" \ 47 + --argv0 '"$0"' \ 48 + --suffix PATH : "$env/bin" \ 49 + --prefix XDG_CONFIG_DIRS : "$env/share" \ 50 + --prefix XDG_DATA_DIRS : "$env/etc/xdg" \ 51 + --set QML_IMPORT_PATH "$env/lib/qt5/imports" \ 52 + --set QML2_IMPORT_PATH "$env/lib/qt5/qml" \ 53 + --set QT_PLUGIN_PATH "$env/lib/qt5/plugins" 54 + good="1" 55 + break 56 + fi 57 + done 58 + if [ -z "$good" ]; then 59 + echo "file or directory not found in derivations: $t" 60 exit 1 61 fi 62 done 63 64 + ln -s "$env/share" "$out" 65 66 + for drv in $unwrapped; do 67 + if [ -a "$drv/nix-support/propagated-user-env-packages" ]; then 68 + mkdir -p "$out/nix-support" 69 + cat "$drv/nix-support/propagated-user-env-packages" >> "$out/nix-support/propagated-user-env-packages" 70 + fi 71 + done 72 ''; 73 }
+2 -1
pkgs/tools/misc/kronometer/default.nix
··· 23 propagatedBuildInputs = [ kconfig kinit ]; 24 }; 25 in 26 - kdeWrapper unwrapped { 27 targets = [ "bin/kronometer" ]; 28 }
··· 23 propagatedBuildInputs = [ kconfig kinit ]; 24 }; 25 in 26 + kdeWrapper { 27 + inherit unwrapped; 28 targets = [ "bin/kronometer" ]; 29 }
+2 -1
pkgs/tools/misc/peruse/default.nix
··· 37 38 }; 39 40 - in kdeWrapper unwrapped { 41 targets = [ "bin/peruse" ]; 42 }
··· 37 38 }; 39 40 + in kdeWrapper { 41 + inherit unwrapped; 42 targets = [ "bin/peruse" ]; 43 }