Added desktop file generation function and desktop item for firefox

svn path=/nixpkgs/trunk/; revision=15529
This commit is contained in:
Sander van der Burg 2009-05-10 12:03:53 +00:00
parent 52f61aa067
commit a8315aa241
3 changed files with 52 additions and 2 deletions

View File

@ -1,8 +1,18 @@
{stdenv, browser, browserName ? "firefox", nameSuffix ? "", makeWrapper, plugins}:
{stdenv, browser, browserName ? "firefox", nameSuffix ? "", makeDesktopItem, makeWrapper, plugins}:
stdenv.mkDerivation {
name = browser.name + "-with-plugins";
desktopItem = makeDesktopItem {
name = browserName;
exec = browserName;
icon = "${browser}/lib/${browser.name}/icons/mozicon128.png";
comment = "";
desktopName = browserName;
genericName = "Web Browser";
categories = "Application;Network;";
};
buildInputs = [makeWrapper];
buildCommand = ''
@ -16,6 +26,9 @@ stdenv.mkDerivation {
"$out/bin/${browserName}${nameSuffix}" \
--suffix-each MOZ_PLUGIN_PATH ':' "$plugins" \
--suffix-contents PATH ':' "$(filterExisting $(addSuffix /extra-bin-path $plugins))"
ensureDir $out/share/applications
cp $desktopItem/share/applications/* $out/share/applications
'';
# Let each plugin tell us (through its `mozillaPlugin') attribute

View File

@ -0,0 +1,33 @@
{stdenv}:
{ name
, type ? "Application"
, exec
, icon ? ""
, comment ? ""
, terminal ? "false"
, desktopName
, genericName
, mimeType ? ""
, categories ? "Application;Other;"
, encoding ? "UTF-8"
}:
stdenv.mkDerivation {
inherit name;
buildCommand = ''
ensureDir $out/share/applications
cat > $out/share/applications/$name.desktop <<EOF
[Desktop Entry]
Type=${type}
Exec=${exec}
Icon=${icon}
Comment=${comment}
Terminal=${terminal}
Name=${desktopName}
GenericName=${genericName}
MimeType=${mimeType}
Categories=${categories}
Encoding=${encoding}
EOF
'';
}

View File

@ -284,6 +284,10 @@ let
inherit url;
};
makeDesktopItem = import ../build-support/make-desktopitem {
inherit stdenv;
};
makeInitrd = {contents}: import ../build-support/kernel/make-initrd.nix {
inherit stdenv perl cpio contents;
};
@ -6948,7 +6952,7 @@ let
};
wrapFirefox = browser: browserName: nameSuffix: import ../applications/networking/browsers/firefox-wrapper {
inherit stdenv nameSuffix makeWrapper browser browserName;
inherit stdenv nameSuffix makeWrapper makeDesktopItem browser browserName;
plugins =
let enableAdobeFlash = getConfig [ browserName "enableAdobeFlash" ] true;
in