makeDesktopItem: use runCommandLocal

This derivation only creates a simple text file, so it makes sense to do
it locally.

On my setup this reduces build time from 2.2s to 1.2s.
This commit is contained in:
Bjørn Forsman 2019-12-04 22:19:21 +01:00
parent 5b6e958b92
commit e488670764

View File

@ -1,4 +1,4 @@
{stdenv, lib}:
{ lib, runCommandLocal }:
{ name
, type ? "Application"
, exec
@ -13,11 +13,7 @@
, extraEntries ? null
}:
stdenv.mkDerivation {
name = "${name}.desktop";
buildCommand = let
let
optionalEntriesList = [{k="Icon"; v=icon;}
{k="Comment"; v=comment;}
{k="GenericName"; v=genericName;}
@ -29,8 +25,8 @@ stdenv.mkDerivation {
mkEntry = {k, v}: k + "=" + v;
optionalEntriesString = lib.concatMapStringsSep "\n" mkEntry entriesToKeep;
in
runCommandLocal "${name}.desktop" {}
''
mkdir -p $out/share/applications
cat > $out/share/applications/${name}.desktop <<EOF
@ -44,5 +40,4 @@ stdenv.mkDerivation {
${if extraEntries == null then ''EOF'' else ''
${extraEntries}
EOF''}
'';
}
''