xdg-desktop-entries: add module (#1450)
* xdg-desktop-entries: add module rebase * xdg-desktop-entries: adapt to changes in makeDesktopItem This package depends on the makeDesktopItem function in nixpkgs, which recently changed its syntax: https://github.com/NixOS/nixpkgs/pull/91790 This commit makes the module compatible with the new syntax. It also exposes the fileValidation option in makeDesktopItem. Co-authored-by: cwyc <cwyc@users.noreply.github.com> Co-authored-by: --get <--show>
This commit is contained in:
parent
d6bbd02e95
commit
30102ea9e5
7 changed files with 264 additions and 0 deletions
|
|
@ -2,4 +2,5 @@
|
|||
xdg-mime-apps-basics = ./mime-apps-basics.nix;
|
||||
xdg-file-attr-names = ./file-attr-names.nix;
|
||||
xdg-system-dirs = ./system-dirs.nix;
|
||||
xdg-desktop-entries = ./desktop-entries.nix;
|
||||
}
|
||||
|
|
|
|||
58
tests/modules/misc/xdg/desktop-entries.nix
Normal file
58
tests/modules/misc/xdg/desktop-entries.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{ 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;
|
||||
extraConfig = ''
|
||||
[X-ExtraSection]
|
||||
Exec=foo -o
|
||||
'';
|
||||
settings = {
|
||||
Keywords = "calc;math";
|
||||
DBusActivatable = "false";
|
||||
};
|
||||
fileValidation = true;
|
||||
};
|
||||
min = { # minimal definition
|
||||
exec = "test --option";
|
||||
name = "Test";
|
||||
};
|
||||
};
|
||||
|
||||
#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";
|
||||
})
|
||||
];
|
||||
|
||||
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}
|
||||
'';
|
||||
};
|
||||
}
|
||||
16
tests/modules/misc/xdg/desktop-full-expected.desktop
Normal file
16
tests/modules/misc/xdg/desktop-full-expected.desktop
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[Desktop Entry]
|
||||
Categories=Network;WebBrowser;
|
||||
Comment=My Application
|
||||
DBusActivatable=false
|
||||
Exec=test --option
|
||||
GenericName=Web Browser
|
||||
Icon=test
|
||||
Keywords=calc;math
|
||||
MimeType=text/html;text/xml;
|
||||
Name=Test
|
||||
StartupNotify=false
|
||||
Terminal=true
|
||||
Type=Application
|
||||
[X-ExtraSection]
|
||||
Exec=foo -o
|
||||
|
||||
5
tests/modules/misc/xdg/desktop-min-expected.desktop
Normal file
5
tests/modules/misc/xdg/desktop-min-expected.desktop
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[Desktop Entry]
|
||||
Exec=test --option
|
||||
Name=Test
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Loading…
Add table
Add a link
Reference in a new issue