Merge pull request #26416 from lverns/make-genericName-optional
make-desktopitem: make genericName optional
This commit is contained in:
commit
ba9db083ac
@ -1,36 +1,48 @@
|
|||||||
{stdenv}:
|
{stdenv, lib}:
|
||||||
{ name
|
{ name
|
||||||
, type ? "Application"
|
, type ? "Application"
|
||||||
, exec
|
, exec
|
||||||
, icon ? ""
|
, icon ? null
|
||||||
, comment ? ""
|
, comment ? null
|
||||||
, terminal ? "false"
|
, terminal ? "false"
|
||||||
, desktopName
|
, desktopName
|
||||||
, genericName
|
, genericName ? null
|
||||||
, mimeType ? ""
|
, mimeType ? null
|
||||||
, categories ? "Application;Other;"
|
, categories ? "Application;Other;"
|
||||||
, startupNotify ? null
|
, startupNotify ? null
|
||||||
, extraEntries ? ""
|
, extraEntries ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "${name}.desktop";
|
name = "${name}.desktop";
|
||||||
buildCommand = ''
|
|
||||||
|
buildCommand = let
|
||||||
|
|
||||||
|
optionalEntriesList = [{k="Icon"; v=icon;}
|
||||||
|
{k="Comment"; v=comment;}
|
||||||
|
{k="GenericName"; v=genericName;}
|
||||||
|
{k="MimeType"; v=mimeType;}
|
||||||
|
{k="StartupNotify"; v=startupNotify;}];
|
||||||
|
|
||||||
|
valueNotNull = {k, v}: v != null;
|
||||||
|
entriesToKeep = builtins.filter valueNotNull optionalEntriesList;
|
||||||
|
|
||||||
|
mkEntry = {k, v}: k + "=" + v;
|
||||||
|
optionalEntriesString = lib.concatMapStringsSep "\n" mkEntry entriesToKeep;
|
||||||
|
|
||||||
|
in
|
||||||
|
''
|
||||||
mkdir -p $out/share/applications
|
mkdir -p $out/share/applications
|
||||||
cat > $out/share/applications/${name}.desktop <<EOF
|
cat > $out/share/applications/${name}.desktop <<EOF
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=${type}
|
Type=${type}
|
||||||
Exec=${exec}
|
Exec=${exec}
|
||||||
Icon=${icon}
|
|
||||||
Comment=${comment}
|
|
||||||
Terminal=${terminal}
|
Terminal=${terminal}
|
||||||
Name=${desktopName}
|
Name=${desktopName}
|
||||||
GenericName=${genericName}
|
|
||||||
MimeType=${mimeType}
|
|
||||||
Categories=${categories}
|
Categories=${categories}
|
||||||
|
${optionalEntriesString}
|
||||||
|
${if extraEntries == null then ''EOF'' else ''
|
||||||
${extraEntries}
|
${extraEntries}
|
||||||
${if startupNotify == null then ''EOF'' else ''
|
|
||||||
StartupNotify=${startupNotify}
|
|
||||||
EOF''}
|
EOF''}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user