summary refs log tree commit diff
path: root/pkgs/build-support/make-desktopitem
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2019-12-04 22:19:21 +0100
committerBjørn Forsman <bjorn.forsman@gmail.com>2019-12-08 20:47:27 +0100
commite488670764c520394c0780c99dbaad15de143aae (patch)
tree52d333ee1f9983f638c3a175071b60f3b30ceb23 /pkgs/build-support/make-desktopitem
parent5b6e958b925e6f061c753031b0a4c704c1ae80c8 (diff)
downloadnixpkgs-e488670764c520394c0780c99dbaad15de143aae.tar
nixpkgs-e488670764c520394c0780c99dbaad15de143aae.tar.gz
nixpkgs-e488670764c520394c0780c99dbaad15de143aae.tar.bz2
nixpkgs-e488670764c520394c0780c99dbaad15de143aae.tar.lz
nixpkgs-e488670764c520394c0780c99dbaad15de143aae.tar.xz
nixpkgs-e488670764c520394c0780c99dbaad15de143aae.tar.zst
nixpkgs-e488670764c520394c0780c99dbaad15de143aae.zip
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.
Diffstat (limited to 'pkgs/build-support/make-desktopitem')
-rw-r--r--pkgs/build-support/make-desktopitem/default.nix33
1 files changed, 14 insertions, 19 deletions
diff --git a/pkgs/build-support/make-desktopitem/default.nix b/pkgs/build-support/make-desktopitem/default.nix
index f8c31ed5c1d..67b82fd66db 100644
--- a/pkgs/build-support/make-desktopitem/default.nix
+++ b/pkgs/build-support/make-desktopitem/default.nix
@@ -1,4 +1,4 @@
-{stdenv, lib}:
+{ lib, runCommandLocal }:
 { name
 , type ? "Application"
 , exec
@@ -13,24 +13,20 @@
 , extraEntries ? null
 }:
 
-stdenv.mkDerivation {
-  name = "${name}.desktop";
+let
+  optionalEntriesList = [{k="Icon";          v=icon;}
+                         {k="Comment";       v=comment;}
+                         {k="GenericName";   v=genericName;}
+                         {k="MimeType";      v=mimeType;}
+                         {k="StartupNotify"; v=startupNotify;}];
 
-  buildCommand = let
+  valueNotNull = {k, v}: v != null;
+  entriesToKeep = builtins.filter valueNotNull optionalEntriesList;
 
-   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
+  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''}
-  '';
-}
+  ''