about summary refs log tree commit diff
path: root/pkgs/build-support/make-desktopitem/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/make-desktopitem/default.nix')
-rw-r--r--pkgs/build-support/make-desktopitem/default.nix9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkgs/build-support/make-desktopitem/default.nix b/pkgs/build-support/make-desktopitem/default.nix
index 787f0f678471a..e0a57f4aa3f6f 100644
--- a/pkgs/build-support/make-desktopitem/default.nix
+++ b/pkgs/build-support/make-desktopitem/default.nix
@@ -34,6 +34,11 @@
 , extraConfig ? {} # Additional values to be added literally to the final item, e.g. vendor extensions
 }:
 let
+  # FIXME: workaround until https://github.com/NixOS/nixpkgs/pull/162246 lands
+  cleanName = if lib.hasInfix " " name
+                then throw "Name must not contain spaces!"
+                else name;
+
   # There are multiple places in the FDO spec that make "boolean" values actually tristate,
   # e.g. StartupNotify, where "unset" is literally defined as "do something reasonable".
   # So, handle null values separately.
@@ -111,8 +116,8 @@ let
   content = [ mainSectionRendered ] ++ actionsRendered;
 in
 writeTextFile {
-  name = "${name}.desktop";
-  destination = "/share/applications/${name}.desktop";
+  name = "${cleanName}.desktop";
+  destination = "/share/applications/${cleanName}.desktop";
   text = builtins.concatStringsSep "\n" content;
   checkPhase = "${desktop-file-utils}/bin/desktop-file-validate $target";
 }