2021-06-03 01:36:17 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
config = {
|
|
|
|
xdg.desktopEntries = {
|
|
|
|
full = { # full definition
|
|
|
|
type = "Application";
|
|
|
|
exec = "test --option";
|
|
|
|
icon = "test";
|
|
|
|
comment = "My Application";
|
|
|
|
terminal = true;
|
|
|
|
name = "Test";
|
|
|
|
genericName = "Web Browser";
|
|
|
|
mimeType = [ "text/html" "text/xml" ];
|
|
|
|
categories = [ "Network" "WebBrowser" ];
|
|
|
|
startupNotify = false;
|
2022-01-05 04:58:20 +01:00
|
|
|
noDisplay = false;
|
|
|
|
prefersNonDefaultGPU = false;
|
2021-06-03 01:36:17 +02:00
|
|
|
settings = {
|
|
|
|
Keywords = "calc;math";
|
|
|
|
DBusActivatable = "false";
|
|
|
|
};
|
2022-04-18 00:06:09 +02:00
|
|
|
actions = {
|
|
|
|
"New-Window" = {
|
|
|
|
name = "New Window";
|
|
|
|
exec = "test --new-window";
|
|
|
|
icon = "test";
|
|
|
|
};
|
|
|
|
"Default" = { exec = "test --default"; };
|
|
|
|
};
|
2021-06-03 01:36:17 +02:00
|
|
|
};
|
|
|
|
min = { # minimal definition
|
|
|
|
exec = "test --option";
|
|
|
|
name = "Test";
|
|
|
|
};
|
2022-04-18 00:06:09 +02:00
|
|
|
deprecated = {
|
|
|
|
exec = "test --option";
|
|
|
|
name = "Test";
|
|
|
|
# Deprecated options
|
|
|
|
fileValidation = true;
|
|
|
|
extraConfig = ''
|
|
|
|
[X-ExtraSection]
|
|
|
|
Exec=foo -o
|
|
|
|
'';
|
|
|
|
};
|
2021-06-03 01:36:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#testing that preexisting entries in the store are overridden
|
|
|
|
home.packages = [
|
|
|
|
(pkgs.makeDesktopItem {
|
|
|
|
name = "full";
|
|
|
|
desktopName = "We don't want this";
|
|
|
|
exec = "no";
|
|
|
|
})
|
|
|
|
(pkgs.makeDesktopItem {
|
|
|
|
name = "min";
|
|
|
|
desktopName = "We don't want this";
|
|
|
|
exec = "no";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-03-02 15:01:40 +01:00
|
|
|
test.asserts.assertions.expected =
|
|
|
|
let currentFile = toString ./desktop-entries.nix;
|
2022-04-18 00:06:09 +02:00
|
|
|
in [
|
|
|
|
''
|
|
|
|
The option definition `fileValidation' in `${currentFile}' no longer has any effect; please remove it.
|
|
|
|
Validation of the desktop file is always enabled.
|
|
|
|
''
|
|
|
|
''
|
|
|
|
The option definition `extraConfig' in `${currentFile}' no longer has any effect; please remove it.
|
|
|
|
The `extraConfig` option of `xdg.desktopEntries` has been removed following a change in Nixpkgs.
|
|
|
|
''
|
|
|
|
];
|
2022-03-02 15:01:40 +01:00
|
|
|
|
2021-06-03 01:36:17 +02:00
|
|
|
nmt.script = ''
|
|
|
|
assertFileExists home-path/share/applications/full.desktop
|
|
|
|
assertFileExists home-path/share/applications/min.desktop
|
|
|
|
assertFileContent home-path/share/applications/full.desktop \
|
|
|
|
${./desktop-full-expected.desktop}
|
|
|
|
assertFileContent home-path/share/applications/min.desktop \
|
|
|
|
${./desktop-min-expected.desktop}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|