From ec06f419af79207b33d797064dfb3fc9dbe1df4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Na=C3=AFm=20Favier?= <n@monade.li>
Date: Tue, 4 Apr 2023 10:41:46 +0200
Subject: [PATCH] xdg-desktop-entries: make `exec` default to null (#3827)

The [specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html)
does not require those keys to be set, and the type reflects that, so
they should default to null.
---
 modules/misc/xdg-desktop-entries.nix                | 6 ++----
 tests/modules/misc/xdg/desktop-entries.nix          | 1 -
 tests/modules/misc/xdg/desktop-min-expected.desktop | 1 -
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/modules/misc/xdg-desktop-entries.nix b/modules/misc/xdg-desktop-entries.nix
index 3274f6ec..c538eda3 100644
--- a/modules/misc/xdg-desktop-entries.nix
+++ b/modules/misc/xdg-desktop-entries.nix
@@ -34,6 +34,7 @@ let
       exec = mkOption {
         description = "Program to execute, possibly with arguments.";
         type = types.nullOr types.str;
+        default = null;
       };
 
       icon = mkOption {
@@ -131,6 +132,7 @@ let
           options.exec = mkOption {
             type = types.nullOr types.str;
             description = "Program to execute, possibly with arguments.";
+            default = null;
           };
           options.icon = mkOption {
             type = with types; nullOr (either str path);
@@ -162,10 +164,6 @@ let
     };
   };
 
-  #formatting helpers
-  semicolonList = list:
-    (concatStringsSep ";" list) + ";"; # requires trailing semicolon
-
   #passes config options to makeDesktopItem in expected format
   makeFile = name: config:
     pkgs.makeDesktopItem {
diff --git a/tests/modules/misc/xdg/desktop-entries.nix b/tests/modules/misc/xdg/desktop-entries.nix
index 541a7cc5..5f00029b 100644
--- a/tests/modules/misc/xdg/desktop-entries.nix
+++ b/tests/modules/misc/xdg/desktop-entries.nix
@@ -32,7 +32,6 @@ with lib;
         };
       };
       min = { # minimal definition
-        exec = "test --option";
         name = "Test";
       };
       deprecated = {
diff --git a/tests/modules/misc/xdg/desktop-min-expected.desktop b/tests/modules/misc/xdg/desktop-min-expected.desktop
index 1b36b57c..da4d7bfd 100644
--- a/tests/modules/misc/xdg/desktop-min-expected.desktop
+++ b/tests/modules/misc/xdg/desktop-min-expected.desktop
@@ -1,5 +1,4 @@
 [Desktop Entry]
-Exec=test --option
 Name=Test
 Terminal=false
 Type=Application