about summary refs log tree commit diff
path: root/pkgs/desktops/xfce/core
diff options
context:
space:
mode:
authorRaymond Gauthier <jraygauthier@gmail.com>2015-10-10 12:16:42 -0400
committerVladimír Čunát <vcunat@gmail.com>2015-11-24 09:51:39 +0100
commit662bbb526c09e522846183005f56ace7b709ef76 (patch)
treed81e553d9bf1339e7feac71a0d04de2feaab8c2e /pkgs/desktops/xfce/core
parentb2409581f8aee234399508764ff8f596f1835056 (diff)
downloadnixlib-662bbb526c09e522846183005f56ace7b709ef76.tar
nixlib-662bbb526c09e522846183005f56ace7b709ef76.tar.gz
nixlib-662bbb526c09e522846183005f56ace7b709ef76.tar.bz2
nixlib-662bbb526c09e522846183005f56ace7b709ef76.tar.lz
nixlib-662bbb526c09e522846183005f56ace7b709ef76.tar.xz
nixlib-662bbb526c09e522846183005f56ace7b709ef76.tar.zst
nixlib-662bbb526c09e522846183005f56ace7b709ef76.zip
thunar: improvements (close #10306)
Add the possibility to specify plugin set to
be used as overridable `thunar` derivation argument.

New nixos config attribute:
`services.xserver.desktopManager.xfce.thunarPlugins`
that allows user to specify plugins in the context
of nixos.

Tests:

 -  With and without plugins.
 -  Using the nixos attributes.
Diffstat (limited to 'pkgs/desktops/xfce/core')
-rw-r--r--pkgs/desktops/xfce/core/thunar-build.nix38
-rw-r--r--pkgs/desktops/xfce/core/thunar.nix85
2 files changed, 96 insertions, 27 deletions
diff --git a/pkgs/desktops/xfce/core/thunar-build.nix b/pkgs/desktops/xfce/core/thunar-build.nix
new file mode 100644
index 000000000000..7a69295d34dd
--- /dev/null
+++ b/pkgs/desktops/xfce/core/thunar-build.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, pkgconfig, intltool
+, gtk, dbus_glib, libstartup_notification, libnotify, libexif, pcre, udev
+, exo, libxfce4util, xfconf, xfce4panel
+}:
+
+stdenv.mkDerivation rec {
+  p_name  = "thunar";
+  ver_maj = "1.6";
+  ver_min = "10";
+
+  src = fetchurl {
+    url = "mirror://xfce/src/xfce/${p_name}/${ver_maj}/Thunar-${ver_maj}.${ver_min}.tar.bz2";
+    sha256 = "7e9d24067268900e5e44d3325e60a1a2b2f8f556ec238ec12574fbea15fdee8a";
+  };
+
+  name = "${p_name}-build-${ver_maj}.${ver_min}";
+
+  patches = [ ./thunarx_plugins_directory.patch ];
+
+  buildInputs = [
+    pkgconfig intltool
+    gtk dbus_glib libstartup_notification libnotify libexif pcre udev
+    exo libxfce4util xfconf xfce4panel
+  ];
+  # TODO: optionality?
+
+  enableParallelBuilding = true;
+
+  preFixup = "rm $out/share/icons/hicolor/icon-theme.cache";
+
+  meta = {
+    homepage = http://thunar.xfce.org/;
+    description = "Xfce file manager";
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.linux;
+    maintainers = [ stdenv.lib.maintainers.eelco ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/desktops/xfce/core/thunar.nix b/pkgs/desktops/xfce/core/thunar.nix
index 1ddab2b07525..037a3f947fbe 100644
--- a/pkgs/desktops/xfce/core/thunar.nix
+++ b/pkgs/desktops/xfce/core/thunar.nix
@@ -1,37 +1,68 @@
-{ stdenv, fetchurl, pkgconfig, intltool
-, gtk, dbus_glib, libstartup_notification, libnotify, libexif, pcre, udev
-, exo, libxfce4util,  xfconf, xfce4panel
+{ stdenv, buildEnv, runCommand, makeWrapper, lndir, thunar-build
+, thunarPlugins ? []
 }:
 
-stdenv.mkDerivation rec {
-  p_name  = "thunar";
-  ver_maj = "1.6";
-  ver_min = "10";
+with stdenv.lib; 
 
-  src = fetchurl {
-    url = "mirror://xfce/src/xfce/${p_name}/${ver_maj}/Thunar-${ver_maj}.${ver_min}.tar.bz2";
-    sha256 = "7e9d24067268900e5e44d3325e60a1a2b2f8f556ec238ec12574fbea15fdee8a";
-  };
-  name = "${p_name}-${ver_maj}.${ver_min}";
+let
+
+  build = thunar-build;
 
-  patches = [ ./thunarx_plugins_directory.patch ];
+  replaceLnExeListWithWrapped = exeDir: exeNameList: mkWrapArgs: ''
+    exeDir="${exeDir}"
+    oriDir=`realpath -e "$exeDir"`
+    unlink "$exeDir"
+    mkdir -p "$exeDir"
+    lndir "$oriDir" "$exeDir"
 
-  buildInputs = [
-    pkgconfig intltool
-    gtk dbus_glib libstartup_notification libnotify libexif pcre udev
-    exo libxfce4util xfconf xfce4panel
-  ];
-  # TODO: optionality?
+    exeList="${concatStrings (intersperse " " (map (x: "${exeDir}/${x}") exeNameList))}"
 
-  enableParallelBuilding = true;
+    for exe in $exeList; do
+      oriExe=`realpath -e "$exe"`
+      rm -f "$exe"
+      makeWrapper "$oriExe" "$exe" ${concatStrings (intersperse " " mkWrapArgs)}
+    done
+  '';
 
-  preFixup = "rm $out/share/icons/hicolor/icon-theme.cache";
+  name = "${build.p_name}-${build.ver_maj}.${build.ver_min}";
 
   meta = {
-    homepage = http://thunar.xfce.org/;
-    description = "Xfce file manager";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.eelco ];
+    inherit (build.meta) homepage license platforms;
+
+    description = build.meta.description + optionalString
+      (0 != length thunarPlugins)
+      " (with plugins: ${concatStrings (intersperse ", " (map (x: x.name) thunarPlugins))})";
+    maintainers = build.meta.maintainers /*++ [ jraygauthier ]*/;
   };
-}
+
+in
+
+# TODO: To be replaced with `buildEnv` awaiting missing features.
+runCommand name {
+  inherit build;
+  inherit meta;
+
+  nativeBuildInputs = [ makeWrapper lndir ];
+
+  dontPatchELF = true;
+  dontStrip = true;
+
+} 
+(let
+  buildWithPlugins = buildEnv {
+    name = "thunar-build-with-plugins";
+    paths = [ build ] ++ thunarPlugins;
+  };
+
+in ''
+  mkdir -p $out
+  pushd ${buildWithPlugins} > /dev/null
+  for d in `find . -maxdepth 1 -name "*" -printf "%f\n" | tail -n+2`; do
+    ln -s "${buildWithPlugins}/$d" "$out/$d"
+  done
+  popd > /dev/null
+
+  ${replaceLnExeListWithWrapped "$out/bin" [ "thunar" "thunar-settings" ] [
+    "--set THUNARX_MODULE_DIR \"${buildWithPlugins}/lib/thunarx-2\""
+  ]}
+'')