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.
This commit is contained in:
Raymond Gauthier 2015-10-10 12:16:42 -04:00 committed by Vladimír Čunát
parent b2409581f8
commit 662bbb526c
6 changed files with 111 additions and 32 deletions

@ -18,6 +18,14 @@ in
description = "Enable the Xfce desktop environment.";
};
services.xserver.desktopManager.xfce.thunarPlugins = mkOption {
default = [];
type = types.listOf types.package;
example = literalExample "[ pkgs.xfce.thunar-archive-plugin ]";
description = ''
A list of plugin that should be installed with Thunar.
'';
};
};
@ -49,7 +57,7 @@ in
pkgs.xfce.mousepad
pkgs.xfce.ristretto
pkgs.xfce.terminal
pkgs.xfce.thunar
(pkgs.xfce.thunar.override { thunarPlugins = cfg.thunarPlugins; })
pkgs.xfce.xfce4icontheme
pkgs.xfce.xfce4panel
pkgs.xfce.xfce4session

@ -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 ];
};
}

@ -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
patches = [ ./thunarx_plugins_directory.patch ];
build = thunar-build;
buildInputs = [
pkgconfig intltool
gtk dbus_glib libstartup_notification libnotify libexif pcre udev
exo libxfce4util xfconf xfce4panel
];
# TODO: optionality?
replaceLnExeListWithWrapped = exeDir: exeNameList: mkWrapArgs: ''
exeDir="${exeDir}"
oriDir=`realpath -e "$exeDir"`
unlink "$exeDir"
mkdir -p "$exeDir"
lndir "$oriDir" "$exeDir"
enableParallelBuilding = true;
exeList="${concatStrings (intersperse " " (map (x: "${exeDir}/${x}") exeNameList))}"
preFixup = "rm $out/share/icons/hicolor/icon-theme.cache";
for exe in $exeList; do
oriExe=`realpath -e "$exe"`
rm -f "$exe"
makeWrapper "$oriExe" "$exe" ${concatStrings (intersperse " " mkWrapArgs)}
done
'';
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\""
]}
'')

@ -26,7 +26,9 @@ xfce_self = rec { # the lines are very long but it seems better than the even-od
libxfce4ui_gtk3 = libxfce4ui.override { withGtk3 = true; };
libxfce4util = callPackage ./core/libxfce4util.nix { };
libxfcegui4 = callPackage ./core/libxfcegui4.nix { };
thunar-build = callPackage ./core/thunar-build.nix { };
thunar = callPackage ./core/thunar.nix { };
thunarx-2-dev = thunar-build; # Plugins need only the `thunarx-2` part of the package. Awaiting multiple outputs.
thunar_volman = callPackage ./core/thunar-volman.nix { }; # ToDo: probably inside Thunar now
thunar-archive-plugin
= callPackage ./thunar-plugins/archive { };

@ -1,6 +1,6 @@
{ stdenv, fetchFromGitHub, pkgconfig, xfce4_dev_tools
, gtk
, thunar
, thunarx-2-dev
, exo, libxfce4util, libxfce4ui
, xfconf, udev, libnotify
}:
@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
buildInputs = [
pkgconfig
xfce4_dev_tools
thunar
thunarx-2-dev
exo gtk libxfce4util libxfce4ui
xfconf udev libnotify
];

@ -1,6 +1,6 @@
{ stdenv, fetchurl, pkgconfig
, gtk
, thunar, python2
, thunarx-2-dev, python2
}:
stdenv.mkDerivation rec {
@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
buildInputs = [
pkgconfig
gtk
thunar python2
thunarx-2-dev python2
];
configurePhase = "python2 waf configure --prefix=$out";