keepassxc: add module
This commit is contained in:
parent
d0240a064d
commit
be33c3f932
|
@ -135,6 +135,7 @@ let
|
|||
./programs/just.nix
|
||||
./programs/k9s.nix
|
||||
./programs/kakoune.nix
|
||||
./programs/keepassxc.nix
|
||||
./programs/keychain.nix
|
||||
./programs/khal.nix
|
||||
./programs/khard.nix
|
||||
|
|
50
modules/programs/keepassxc.nix
Normal file
50
modules/programs/keepassxc.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{ 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" { };
|
||||
|
||||
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 {
|
||||
home.packages = [ cfg.package ];
|
||||
xdg.configFile = {
|
||||
"keepassxc/keepassxc.ini" = lib.mkIf (cfg.settings != { }) {
|
||||
source = iniFormat.generate "keepassxc-settings" cfg.settings;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -92,6 +92,7 @@ in import nmtSrc {
|
|||
./modules/programs/joplin-desktop
|
||||
./modules/programs/k9s
|
||||
./modules/programs/kakoune
|
||||
./modules/programs/keepassxc
|
||||
./modules/programs/khal
|
||||
./modules/programs/khard
|
||||
./modules/programs/kitty
|
||||
|
|
11
tests/modules/programs/keepassxc/default-settings.nix
Normal file
11
tests/modules/programs/keepassxc/default-settings.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.keepassxc = { enable = true; };
|
||||
|
||||
test.stubs.keepassxc = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/keepassxc/keepassxc.ini
|
||||
'';
|
||||
}
|
4
tests/modules/programs/keepassxc/default.nix
Normal file
4
tests/modules/programs/keepassxc/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
keepassxc-default-settings = ./default-settings.nix;
|
||||
keepassxc-example-settings = ./example-settings.nix;
|
||||
}
|
24
tests/modules/programs/keepassxc/example-settings.nix
Normal file
24
tests/modules/programs/keepassxc/example-settings.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.keepassxc = {
|
||||
enable = true;
|
||||
settings = {
|
||||
Browser.Enabled = true;
|
||||
GUI = {
|
||||
AdvancedSettings = true;
|
||||
ApplicationTheme = "dark";
|
||||
CompactMode = true;
|
||||
HidePasswords = true;
|
||||
};
|
||||
SSHAgent.Enabled = true;
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.keepassxc = { };
|
||||
|
||||
nmt.script = ''
|
||||
configFile=home-files/.config/keepassxc/keepassxc.ini
|
||||
assertFileContent $configFile ${./keepassxc-example-config.ini}
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
[Browser]
|
||||
Enabled=true
|
||||
|
||||
[GUI]
|
||||
AdvancedSettings=true
|
||||
ApplicationTheme=dark
|
||||
CompactMode=true
|
||||
HidePasswords=true
|
||||
|
||||
[SSHAgent]
|
||||
Enabled=true
|
Loading…
Reference in a new issue