1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 13:39:46 +01:00
home-manager/tests/modules/misc/xdg/desktop-entries.nix
cwyc 30102ea9e5
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>
2021-06-02 19:36:17 -04:00

58 lines
1.5 KiB
Nix

{ 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}
'';
};
}