mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-04-30 12:19:11 +00:00
nixos/xdg/desktop-entries: init
This commit is contained in:
parent
45228e6dea
commit
132b15c85d
@ -16,6 +16,7 @@
|
||||
./services/vouch-proxy.nix
|
||||
./services/yt-dlp.nix
|
||||
./xdg/autostart-entries.nix
|
||||
./xdg/desktop-entries.nix
|
||||
./xdg/mime-desktop-specific.nix
|
||||
./virtualisation/oci-containers
|
||||
];
|
||||
|
42
modules/nixos/xdg/desktop-entries.nix
Normal file
42
modules/nixos/xdg/desktop-entries.nix
Normal 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;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user