2015-10-10 18:16:42 +02:00
|
|
|
{ stdenv, buildEnv, runCommand, makeWrapper, lndir, thunar-build
|
|
|
|
, thunarPlugins ? []
|
2013-02-21 12:16:51 +01:00
|
|
|
}:
|
|
|
|
|
2015-10-10 18:16:42 +02:00
|
|
|
with stdenv.lib;
|
2013-02-21 12:16:51 +01:00
|
|
|
|
2015-10-10 18:16:42 +02:00
|
|
|
let
|
|
|
|
|
|
|
|
build = thunar-build;
|
2013-02-21 12:16:51 +01:00
|
|
|
|
2015-10-10 18:16:42 +02:00
|
|
|
replaceLnExeListWithWrapped = exeDir: exeNameList: mkWrapArgs: ''
|
|
|
|
exeDir="${exeDir}"
|
|
|
|
oriDir=`realpath -e "$exeDir"`
|
|
|
|
unlink "$exeDir"
|
|
|
|
mkdir -p "$exeDir"
|
|
|
|
lndir "$oriDir" "$exeDir"
|
2015-09-18 08:02:16 +02:00
|
|
|
|
2015-10-10 18:16:42 +02:00
|
|
|
exeList="${concatStrings (intersperse " " (map (x: "${exeDir}/${x}") exeNameList))}"
|
2013-02-21 12:16:51 +01:00
|
|
|
|
2015-10-10 18:16:42 +02:00
|
|
|
for exe in $exeList; do
|
|
|
|
oriExe=`realpath -e "$exe"`
|
|
|
|
rm -f "$exe"
|
|
|
|
makeWrapper "$oriExe" "$exe" ${concatStrings (intersperse " " mkWrapArgs)}
|
|
|
|
done
|
|
|
|
'';
|
2013-02-21 12:16:51 +01:00
|
|
|
|
2015-10-10 18:16:42 +02:00
|
|
|
name = "${build.p_name}-${build.ver_maj}.${build.ver_min}";
|
2013-02-21 12:16:51 +01:00
|
|
|
|
|
|
|
meta = {
|
2015-10-10 18:16:42 +02:00
|
|
|
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 ]*/;
|
2013-02-21 12:16:51 +01:00
|
|
|
};
|
2015-10-10 18:16:42 +02:00
|
|
|
|
|
|
|
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\""
|
|
|
|
]}
|
|
|
|
'')
|