fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Naïm Favierxdg-desktop-entries: make `exec` default to null (#3827)ec06f419

master
2.4 KiB85 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5{
6  config = {
7    xdg.desktopEntries = {
8      full = { # full definition
9        type = "Application";
10        exec = "test --option";
11        icon = "test";
12        comment = "My Application";
13        terminal = true;
14        name = "Test";
15        genericName = "Web Browser";
16        mimeType = [ "text/html" "text/xml" ];
17        categories = [ "Network" "WebBrowser" ];
18        startupNotify = false;
19        noDisplay = false;
20        prefersNonDefaultGPU = false;
21        settings = {
22          Keywords = "calc;math";
23          DBusActivatable = "false";
24        };
25        actions = {
26          "New-Window" = {
27            name = "New Window";
28            exec = "test --new-window";
29            icon = "test";
30          };
31          "Default" = { exec = "test --default"; };
32        };
33      };
34      min = { # minimal definition
35        name = "Test";
36      };
37      deprecated = {
38        exec = "test --option";
39        name = "Test";
40        # Deprecated options
41        fileValidation = true;
42        extraConfig = ''
43          [X-ExtraSection]
44          Exec=foo -o
45        '';
46      };
47    };
48
49    #testing that preexisting entries in the store are overridden
50    home.packages = [
51      (pkgs.makeDesktopItem {
52        name = "full";
53        desktopName = "We don't want this";
54        exec = "no";
55      })
56      (pkgs.makeDesktopItem {
57        name = "min";
58        desktopName = "We don't want this";
59        exec = "no";
60      })
61    ];
62
63    test.asserts.assertions.expected =
64      let currentFile = toString ./desktop-entries.nix;
65      in [
66        ''
67          The option definition `fileValidation' in `${currentFile}' no longer has any effect; please remove it.
68          Validation of the desktop file is always enabled.
69        ''
70        ''
71          The option definition `extraConfig' in `${currentFile}' no longer has any effect; please remove it.
72          The `extraConfig` option of `xdg.desktopEntries` has been removed following a change in Nixpkgs.
73        ''
74      ];
75
76    nmt.script = ''
77      assertFileExists home-path/share/applications/full.desktop
78      assertFileExists home-path/share/applications/min.desktop
79      assertFileContent home-path/share/applications/full.desktop \
80        ${./desktop-full-expected.desktop}
81      assertFileContent home-path/share/applications/min.desktop \
82        ${./desktop-min-expected.desktop}
83    '';
84  };
85}