1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

himalaya: add xdg desktop entry

This commit is contained in:
Clément DOUIN 2024-04-20 09:49:20 +02:00
parent d761492011
commit 00742ed0ca
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72

View file

@ -154,32 +154,44 @@ in {
config = lib.mkIf himalaya.enable { config = lib.mkIf himalaya.enable {
home.packages = [ himalaya.package ]; home.packages = [ himalaya.package ];
xdg.configFile."himalaya/config.toml".source = let xdg = {
enabledAccounts = lib.filterAttrs (_: account: account.himalaya.enable) configFile."himalaya/config.toml".source = let
config.accounts.email.accounts; enabledAccounts = lib.filterAttrs (_: account: account.himalaya.enable)
accountsConfig = lib.mapAttrs mkAccountConfig enabledAccounts; config.accounts.email.accounts;
globalConfig = compactAttrs himalaya.settings; accountsConfig = lib.mapAttrs mkAccountConfig enabledAccounts;
allConfig = globalConfig // { accounts = accountsConfig; }; globalConfig = compactAttrs himalaya.settings;
in tomlFormat.generate "himalaya-config.toml" allConfig; allConfig = globalConfig // { accounts = accountsConfig; };
in tomlFormat.generate "himalaya-config.toml" allConfig;
systemd.user.services = desktopEntries.himalaya = lib.mkIf pkgs.stdenv.hostPlatform.isLinux {
type = "Application";
name = "himalaya";
genericName = "Email Client";
comment = "CLI to manage emails";
terminal = true;
exec = "himalaya %u";
categories = [ "Network" ];
mimeType = [ "x-scheme-handler/mailto" "message/rfc822" ];
settings = { Keywords = "email"; };
};
};
systemd.user.services."himalaya-watch@" =
let inherit (config.services.himalaya-watch) enable environment; let inherit (config.services.himalaya-watch) enable environment;
in { in lib.mkIf enable {
"himalaya-watch@" = lib.mkIf enable { Unit = {
Unit = { Description = "Email client Himalaya CLI envelopes watcher service";
Description = "Email client Himalaya CLI envelopes watcher service"; After = [ "network.target" ];
After = [ "network.target" ]; };
}; Install = { WantedBy = [ "default.target" ]; };
Install = { WantedBy = [ "default.target" ]; }; Service = {
Service = { ExecStart =
ExecStart = "${lib.getExe himalaya.package} envelopes watch --account %I";
"${lib.getExe himalaya.package} envelopes watch --account %I"; ExecSearchPath = "/bin";
ExecSearchPath = "/bin"; Environment =
Environment = lib.mapAttrsToList (key: val: "${key}=${val}") environment;
lib.mapAttrsToList (key: val: "${key}=${val}") environment; Restart = "always";
Restart = "always"; RestartSec = 10;
RestartSec = 10;
};
}; };
}; };
}; };