nixos/xdg/autostart-entries: init

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

View File

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

View File

@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
let
cfg = config.xdg.autostart;
xdgDesktopEntrySubmodule = { name, ... }: {
freeformType = with lib.types; attrsOf anything;
};
in
{
options.xdg.autostart.entries = lib.mkOption {
type = with lib.types; attrsOf (submodule xdgDesktopEntrySubmodule);
default = { };
description = ''
A set of XDG autostart entries to be exported 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.entries != { }) {
environment.systemPackages =
let
mkXDGAutostartFile = _: v:
pkgs.makeDesktopItem (v // {
destination = "/etc/xdg/autostart";
});
in
lib.mapAttrsToList mkXDGAutostartFile cfg.entries;
};
}