nixos/xdg/desktop-entries: init

This commit is contained in:
Gabriel Arazas 2025-04-22 11:15:01 +08:00
parent 45228e6dea
commit 132b15c85d
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
2 changed files with 43 additions and 0 deletions

View File

@ -16,6 +16,7 @@
./services/vouch-proxy.nix ./services/vouch-proxy.nix
./services/yt-dlp.nix ./services/yt-dlp.nix
./xdg/autostart-entries.nix ./xdg/autostart-entries.nix
./xdg/desktop-entries.nix
./xdg/mime-desktop-specific.nix ./xdg/mime-desktop-specific.nix
./virtualisation/oci-containers ./virtualisation/oci-containers
]; ];

View File

@ -0,0 +1,42 @@
{ config, lib, pkgs, ... }:
let
cfg = config.xdg.desktopEntries;
xdgDesktopEntrySubmodule = { name, ... }: {
freeformType = with lib.types; attrsOf anything;
};
in
{
options.xdg.desktopEntries = lib.mkOption {
type = with lib.types; attrsOf (submodule xdgDesktopEntrySubmodule);
default = { };
description = ''
A set of XDG desktop entries to be exported as part of the applications
list (i.e., {file}`$out/share/applications`) to the environment.
'';
example = lib.literalExpression ''
{
kando = {
name = "kando";
desktopName = "Kando";
exec = lib.getExe pkgs.kando;
icon = "kando";
genericName = "Pie Menu";
};
}
'';
};
config = lib.mkIf (cfg != { }) {
environment.systemPackages =
let
mkXDGDesktopEntry = _: v:
pkgs.makeDesktopItem (v // {
destination = "/share/applications";
});
in
lib.mapAttrsToList mkXDGDesktopEntry cfg;
};
}