summary refs log tree commit diff
path: root/pkgs/desktops/plasma-5/startkde/default.nix
blob: 87c72fdc59955e4be78a1256bc142dcf94e5b373 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
  stdenv, lib, runCommand, dbus, qttools, socat, gnugrep, gnused, kconfig,
  kinit, kservice, plasma-workspace, xmessage, xprop, xsetroot, qtbase,
  qtdeclarative, qtgraphicaleffects, qtquickcontrols, qtquickcontrols2,
  qtscript, qtsvg, qtx11extras, qtxmlpatterns
}:

let

  env = {
    inherit (stdenv) shell;
    bins = builtins.map (pkg: pkg.out or pkg)
      [
        dbus qttools socat
        gnugrep gnused
        kconfig kinit kservice
        plasma-workspace
        xmessage xprop xsetroot
      ];
    libs = builtins.map (pkg: pkg.out or pkg)
      [
        qtbase qtdeclarative qtgraphicaleffects qtquickcontrols qtquickcontrols2
        qtscript qtsvg qtx11extras qtxmlpatterns
      ];
  };

in runCommand "startkde" env ''

  # Configure PATH variable
  suffixPATH=
  for p in $bins; do
      addToSearchPath suffixPATH "$p/bin"
      addToSearchPath suffixPATH "$p/lib/libexec"
      addToSearchPath suffixPATH "$p/lib/libexec/kf5"
  done

  # Configure Qt search paths
  QT_PLUGIN_PATH=
  QML_IMPORT_PATH=
  QML2_IMPORT_PATH=
  for p in $libs; do
      addToSearchPath QT_PLUGIN_PATH "$p/lib/qt5/plugins"
      addToSearchPath QML_IMPORT_PATH "$p/lib/qt5/imports"
      addToSearchPath QML2_IMPORT_PATH "$p/lib/qt5/qml"
  done

  substitute ${./startkde.sh} "$out" \
      --subst-var shell \
      --subst-var suffixPATH \
      --subst-var QT_PLUGIN_PATH \
      --subst-var QML_IMPORT_PATH \
      --subst-var QML2_IMPORT_PATH
  chmod +x "$out"
''