feat: add home assistant capability with pi-relay
This commit is contained in:
parent
2374e3cd60
commit
4f7ac0e7d7
13 changed files with 415 additions and 35 deletions
|
|
@ -12,10 +12,20 @@ in
|
|||
|
||||
users.groups.noisebell = { };
|
||||
|
||||
users.users.noisebell-cache.extraGroups = lib.mkIf cfgCache.enable [ "noisebell" ];
|
||||
users.users.noisebell-rss.extraGroups = lib.mkIf cfgRss.enable [ "noisebell" ];
|
||||
users.users.noisebell-discord.extraGroups = lib.mkIf cfgDiscord.enable [ "noisebell" ];
|
||||
users.users.noisebell-zulip.extraGroups = lib.mkIf cfgZulip.enable [ "noisebell" ];
|
||||
users.users = lib.mkMerge [
|
||||
(lib.mkIf cfgCache.enable {
|
||||
noisebell-cache.extraGroups = [ "noisebell" ];
|
||||
})
|
||||
(lib.mkIf cfgRss.enable {
|
||||
noisebell-rss.extraGroups = [ "noisebell" ];
|
||||
})
|
||||
(lib.mkIf cfgDiscord.enable {
|
||||
noisebell-discord.extraGroups = [ "noisebell" ];
|
||||
})
|
||||
(lib.mkIf cfgZulip.enable {
|
||||
noisebell-zulip.extraGroups = [ "noisebell" ];
|
||||
})
|
||||
];
|
||||
|
||||
age.secrets.noisebell-pi-to-cache-key = {
|
||||
file = "${self}/secrets/pi-to-cache-key.age";
|
||||
|
|
@ -47,6 +57,12 @@ in
|
|||
mode = "0440";
|
||||
};
|
||||
|
||||
age.secrets.noisebell-relay-webhook-secret = {
|
||||
file = "${self}/secrets/relay-webhook-secret.age";
|
||||
group = "noisebell";
|
||||
mode = "0440";
|
||||
};
|
||||
|
||||
age.secrets.noisebell-zulip-webhook-secret = {
|
||||
file = "${self}/secrets/zulip-webhook-secret.age";
|
||||
group = "noisebell";
|
||||
|
|
@ -68,30 +84,30 @@ in
|
|||
);
|
||||
};
|
||||
|
||||
services.noisebell-rss = lib.mkIf cfgRss.enable (
|
||||
lib.optionalAttrs cfgCache.enable {
|
||||
cacheUrl = lib.mkDefault "http://127.0.0.1:${toString cfgCache.port}";
|
||||
}
|
||||
services.noisebell-rss.cacheUrl = lib.mkIf (cfgRss.enable && cfgCache.enable) (
|
||||
lib.mkDefault "http://127.0.0.1:${toString cfgCache.port}"
|
||||
);
|
||||
|
||||
services.noisebell-discord = lib.mkIf cfgDiscord.enable (
|
||||
{
|
||||
discordTokenFile = lib.mkDefault config.age.secrets.noisebell-discord-token.path;
|
||||
webhookSecretFile = lib.mkDefault config.age.secrets.noisebell-discord-webhook-secret.path;
|
||||
}
|
||||
// lib.optionalAttrs cfgCache.enable {
|
||||
cacheUrl = lib.mkDefault "http://127.0.0.1:${toString cfgCache.port}";
|
||||
imageBaseUrl = lib.mkDefault "https://${cfgCache.domain}/image";
|
||||
}
|
||||
services.noisebell-discord.discordTokenFile = lib.mkIf cfgDiscord.enable (
|
||||
lib.mkDefault config.age.secrets.noisebell-discord-token.path
|
||||
);
|
||||
services.noisebell-discord.webhookSecretFile = lib.mkIf cfgDiscord.enable (
|
||||
lib.mkDefault config.age.secrets.noisebell-discord-webhook-secret.path
|
||||
);
|
||||
services.noisebell-discord.cacheUrl = lib.mkIf (cfgDiscord.enable && cfgCache.enable) (
|
||||
lib.mkDefault "http://127.0.0.1:${toString cfgCache.port}"
|
||||
);
|
||||
services.noisebell-discord.imageBaseUrl = lib.mkIf (cfgDiscord.enable && cfgCache.enable) (
|
||||
lib.mkDefault "https://${cfgCache.domain}/image"
|
||||
);
|
||||
|
||||
services.noisebell-zulip = lib.mkIf cfgZulip.enable (
|
||||
{
|
||||
apiKeyFile = lib.mkDefault config.age.secrets.noisebell-zulip-api-key.path;
|
||||
webhookSecretFile = lib.mkDefault config.age.secrets.noisebell-zulip-webhook-secret.path;
|
||||
}
|
||||
// lib.optionalAttrs cfgCache.enable {
|
||||
imageBaseUrl = lib.mkDefault "https://${cfgCache.domain}/image";
|
||||
}
|
||||
services.noisebell-zulip.apiKeyFile = lib.mkIf cfgZulip.enable (
|
||||
lib.mkDefault config.age.secrets.noisebell-zulip-api-key.path
|
||||
);
|
||||
services.noisebell-zulip.webhookSecretFile = lib.mkIf cfgZulip.enable (
|
||||
lib.mkDefault config.age.secrets.noisebell-zulip-webhook-secret.path
|
||||
);
|
||||
services.noisebell-zulip.imageBaseUrl = lib.mkIf (cfgZulip.enable && cfgCache.enable) (
|
||||
lib.mkDefault "https://${cfgCache.domain}/image"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue