mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-04-30 18:19:12 +00:00
43 lines
1.0 KiB
Nix
43 lines
1.0 KiB
Nix
{ 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;
|
|
};
|
|
}
|
|
|