32 lines
1.2 KiB
Nix
32 lines
1.2 KiB
Nix
{ config, lib, ... }:
|
|
|
|
{
|
|
options.snowflake.home.autostart = {
|
|
enable = lib.mkEnableOption "enable autostart module";
|
|
pkgs = lib.mkOption {
|
|
type = lib.types.listOf lib.types.package;
|
|
default = [ ];
|
|
description = "packages to autostart";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf config.snowflake.home.autostart.enable {
|
|
home.file = builtins.listToAttrs (map (pkg: {
|
|
name = ".config/autostart/" + pkg.pname + ".desktop";
|
|
value = if pkg ? desktopItem then {
|
|
# Application has a desktopItem entry.
|
|
# Assume that it was made with makeDesktopEntry, which exposes a
|
|
# text attribute with the contents of the .desktop file
|
|
text = pkg.desktopItem.text;
|
|
} else if pkg.pname == "wezterm" then {
|
|
# custom handling for wezterm since for its desktop file
|
|
source = (pkg + "/share/applications/" + "org.wezfurlong.wezterm"
|
|
+ ".desktop");
|
|
} else {
|
|
# Application does *not* have a desktopItem entry. Try to find a
|
|
# matching .desktop name in /share/apaplications
|
|
source = (pkg + "/share/applications/" + pkg.pname + ".desktop");
|
|
};
|
|
}) config.snowflake.home.autostart.pkgs);
|
|
};
|
|
}
|