about summary refs log tree commit diff
path: root/nixpkgs/pkgs/desktops/pantheon/desktop/wingpanel/wrapper.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/desktops/pantheon/desktop/wingpanel/wrapper.nix')
-rw-r--r--nixpkgs/pkgs/desktops/pantheon/desktop/wingpanel/wrapper.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/desktops/pantheon/desktop/wingpanel/wrapper.nix b/nixpkgs/pkgs/desktops/pantheon/desktop/wingpanel/wrapper.nix
new file mode 100644
index 000000000000..89a359a4c9d2
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/pantheon/desktop/wingpanel/wrapper.nix
@@ -0,0 +1,61 @@
+{ lib
+, wrapGAppsHook
+, glib
+, stdenv
+, xorg
+, wingpanel
+, wingpanelIndicators
+, switchboard-with-plugs
+, indicators ? null
+  # Only useful to disable for development testing.
+, useDefaultIndicators ? true
+}:
+
+let
+  selectedIndicators =
+    if indicators == null then wingpanelIndicators
+    else indicators ++ (lib.optionals useDefaultIndicators wingpanelIndicators);
+in
+stdenv.mkDerivation rec {
+  pname = "${wingpanel.pname}-with-indicators";
+  inherit (wingpanel) version;
+
+  src = null;
+
+  paths = [
+    wingpanel
+  ] ++ selectedIndicators;
+
+  passAsFile = [ "paths" ];
+
+  nativeBuildInputs = [
+    glib
+    wrapGAppsHook
+  ];
+
+  buildInputs = lib.forEach selectedIndicators (x: x.buildInputs)
+    ++ selectedIndicators;
+
+  dontUnpack = true;
+  dontConfigure = true;
+  dontBuild = true;
+
+  preferLocalBuild = true;
+  allowSubstitutes = false;
+
+  installPhase = ''
+    mkdir -p $out
+    for i in $(cat $pathsPath); do
+      ${xorg.lndir}/bin/lndir -silent $i $out
+    done
+  '';
+
+  preFixup = ''
+    gappsWrapperArgs+=(
+      --set WINGPANEL_INDICATORS_PATH "$out/lib/wingpanel"
+      --set SWITCHBOARD_PLUGS_PATH "${switchboard-with-plugs}/lib/switchboard"
+    )
+  '';
+
+  inherit (wingpanel) meta;
+}