summary refs log tree commit diff
path: root/pkgs/build-support/make-desktopitem
diff options
context:
space:
mode:
authorpiegames <git@piegames.de>2020-10-14 01:19:43 +0200
committerpiegames <git@piegames.de>2020-10-14 01:19:43 +0200
commit3a76d4caea59cecf377016a68d70b8c5d057412a (patch)
treec24b80ce789176086d12267baa0c31e5bc23f7ba /pkgs/build-support/make-desktopitem
parent51cc55330719be8918cff038b74f5b2c5612995a (diff)
downloadnixpkgs-3a76d4caea59cecf377016a68d70b8c5d057412a.tar
nixpkgs-3a76d4caea59cecf377016a68d70b8c5d057412a.tar.gz
nixpkgs-3a76d4caea59cecf377016a68d70b8c5d057412a.tar.bz2
nixpkgs-3a76d4caea59cecf377016a68d70b8c5d057412a.tar.lz
nixpkgs-3a76d4caea59cecf377016a68d70b8c5d057412a.tar.xz
nixpkgs-3a76d4caea59cecf377016a68d70b8c5d057412a.tar.zst
nixpkgs-3a76d4caea59cecf377016a68d70b8c5d057412a.zip
make-desktopitem: minor fixes and code style
Diffstat (limited to 'pkgs/build-support/make-desktopitem')
-rw-r--r--pkgs/build-support/make-desktopitem/default.nix22
1 files changed, 12 insertions, 10 deletions
diff --git a/pkgs/build-support/make-desktopitem/default.nix b/pkgs/build-support/make-desktopitem/default.nix
index f5020c036aa..fd46e298513 100644
--- a/pkgs/build-support/make-desktopitem/default.nix
+++ b/pkgs/build-support/make-desktopitem/default.nix
@@ -6,7 +6,7 @@
 , exec
 , icon ? null
 , comment ? null
-, terminal ? "false"
+, terminal ? false
 , desktopName # The name of the application
 , genericName ? null
 , mimeType ? null
@@ -19,20 +19,22 @@
 
 let
   # like builtins.toString, but null -> null instead of null -> ""
-  nullableToString = value: if value == null then null else builtins.toString value;
+  nullableToString = value: if value == null then null
+        else if builtins.isBool value then lib.boolToString value
+        else builtins.toString value;
 
   # The [Desktop entry] section of the desktop file, as attribute set.
   mainSection = {
     "Type" = toString type;
-    "Exec" = (nullableToString exec);
-    "Icon" = (nullableToString icon);
-    "Comment" = (nullableToString comment);
-    "Terminal" = (nullableToString terminal);
+    "Exec" = nullableToString exec;
+    "Icon" = nullableToString icon;
+    "Comment" = nullableToString comment;
+    "Terminal" = nullableToString terminal;
     "Name" = toString name;
-    "GenericName" = (nullableToString genericName);
-    "MimeType" = (nullableToString mimeType);
-    "Categories" = (nullableToString categories);
-    "StartupNotify" = (nullableToString startupNotify);
+    "GenericName" = nullableToString genericName;
+    "MimeType" = nullableToString mimeType;
+    "Categories" = nullableToString categories;
+    "StartupNotify" = nullableToString startupNotify;
   } // extraDesktopEntries;
 
   # Map all entries to a list of lines