1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00
home-manager/modules/programs/algia.nix
2025-09-30 14:41:57 -05:00

57 lines
1.4 KiB
Nix

{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
mkIf
mkEnableOption
mkPackageOption
mkOption
;
cfg = config.programs.algia;
jsonFormat = pkgs.formats.json { };
in
{
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
options.programs.algia = {
enable = mkEnableOption "algia";
package = mkPackageOption pkgs "algia" { nullable = true; };
settings = mkOption {
inherit (jsonFormat) type;
default = { };
example = {
relays = {
"wss =//relay-jp.nostr.wirednet.jp" = {
read = true;
write = true;
search = false;
};
};
privatekey = "nsecXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
};
description = ''
Configuration settings for algia. All the available options can be found here:
<https://github.com/mattn/algia?tab=readme-ov-file#configuration>
'';
};
};
config =
let
configDir =
if pkgs.stdenv.hostPlatform.isDarwin then
".config/algia"
else
"${lib.removePrefix config.home.homeDirectory config.xdg.configHome}/algia";
in
mkIf cfg.enable {
home.packages = mkIf (cfg.package != null) [ cfg.package ];
home.file."${configDir}/config.json" = mkIf (cfg.settings != { }) {
source = jsonFormat.generate "algia-config.json" cfg.settings;
};
};
}