summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2022-02-28 20:10:56 +0300
committerK900 <me@0upti.me>2022-02-28 20:15:33 +0300
commit1e2662c5fdceeebb8060214f457791a57da7c19c (patch)
tree7c734e82131041642a21ce5d433f888766f46476 /pkgs/build-support
parent93a789543ae6b5831ae8040532202caa927f314c (diff)
downloadnixpkgs-1e2662c5fdceeebb8060214f457791a57da7c19c.tar
nixpkgs-1e2662c5fdceeebb8060214f457791a57da7c19c.tar.gz
nixpkgs-1e2662c5fdceeebb8060214f457791a57da7c19c.tar.bz2
nixpkgs-1e2662c5fdceeebb8060214f457791a57da7c19c.tar.lz
nixpkgs-1e2662c5fdceeebb8060214f457791a57da7c19c.tar.xz
nixpkgs-1e2662c5fdceeebb8060214f457791a57da7c19c.tar.zst
nixpkgs-1e2662c5fdceeebb8060214f457791a57da7c19c.zip
treewide: fix some desktop file names
pkgs.writeTextFile doesn't like spaces in filenames.
This is fixed in #162246, but other tools will probably dislike
spaces in .desktop file names as well, and that PR will take forever,
so let's fix this anyway.
Diffstat (limited to 'pkgs/build-support')
-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 787f0f67847..e0a57f4aa3f 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";
 }