1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-01 06:31:04 +01:00
home-manager/modules/programs/keepassxc.nix
Austin Horstman 86402a17b6 treewide: flatten single file modules
Some files don't need nesting and can be root level again to reduce
conflicts with other PRs.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-06-23 16:20:26 -05:00

70 lines
1.7 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.keepassxc;
iniFormat = pkgs.formats.ini { };
in
{
meta.maintainers = [ lib.maintainers.d-brasher ];
options.programs.keepassxc = {
enable = lib.mkEnableOption "keepassxc";
package = lib.mkPackageOption pkgs "keepassxc" { nullable = true; };
settings = lib.mkOption {
type = iniFormat.type;
default = { };
example = lib.literalExpression ''
{
Browser.Enabled = true;
GUI = {
AdvancedSettings = true;
ApplicationTheme = "dark";
CompactMode = true;
HidePasswords = true;
};
SSHAgent.Enabled = true;
}
'';
description = ''
Configuration written to
{file}`$XDG_CONFIG_HOME/keepassxc/keepassxc.ini`.
See <https://github.com/keepassxreboot/keepassxc/blob/647272e9c5542297d3fcf6502e6173c96f12a9a0/src/core/Config.cpp#L49-L223>
for the full list of options.
'';
};
};
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
xdg.configFile = {
"keepassxc/keepassxc.ini" = lib.mkIf (cfg.settings != { }) {
source = iniFormat.generate "keepassxc-settings" cfg.settings;
};
};
}
(lib.mkIf (cfg.package != null) {
home.packages = [ cfg.package ];
programs.brave.nativeMessagingHosts = [ cfg.package ];
programs.chromium.nativeMessagingHosts = [ cfg.package ];
programs.firefox.nativeMessagingHosts = [ cfg.package ];
programs.floorp.nativeMessagingHosts = [ cfg.package ];
programs.vivaldi.nativeMessagingHosts = [ cfg.package ];
})
]
);
}