mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
keepassxc: add autostart option
This commit is contained in:
parent
cb8cfa0eb9
commit
62fdc8d410
3 changed files with 39 additions and 4 deletions
|
|
@ -46,17 +46,37 @@ in
|
||||||
for the full list of options.
|
for the full list of options.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
autostart = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = ''
|
||||||
|
Whether to start Keepassxc automatically on login through the XDG autostart mechanism.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable (
|
config = lib.mkIf cfg.enable (
|
||||||
lib.mkMerge [
|
lib.mkMerge [
|
||||||
|
|
||||||
{
|
{
|
||||||
xdg.configFile = {
|
assertions = [
|
||||||
"keepassxc/keepassxc.ini" = lib.mkIf (cfg.settings != { }) {
|
{
|
||||||
|
assertion = cfg.autostart -> config.xdg.autostart.enable;
|
||||||
|
message = ''
|
||||||
|
{option}`xdg.autostart.enable` has to be enabled in order for
|
||||||
|
{option}`programs.keepassxc.autostart` to be effective.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
xdg.autostart.entries = lib.mkIf cfg.autostart [
|
||||||
|
"${cfg.package}/share/applications/org.keepassxc.KeePassXC.desktop"
|
||||||
|
];
|
||||||
|
xdg.configFile."keepassxc/keepassxc.ini" = lib.mkIf (cfg.settings != { }) {
|
||||||
source = iniFormat.generate "keepassxc-settings" cfg.settings;
|
source = iniFormat.generate "keepassxc-settings" cfg.settings;
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(lib.mkIf (cfg.package != null) {
|
(lib.mkIf (cfg.package != null) {
|
||||||
|
|
|
||||||
14
tests/modules/programs/keepassxc/autostart.nix
Normal file
14
tests/modules/programs/keepassxc/autostart.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
programs.keepassxc = {
|
||||||
|
enable = true;
|
||||||
|
autostart = true;
|
||||||
|
};
|
||||||
|
xdg.autostart.enable = false;
|
||||||
|
|
||||||
|
test.asserts.assertions.expected = [
|
||||||
|
''
|
||||||
|
{option}`xdg.autostart.enable` has to be enabled in order for
|
||||||
|
{option}`programs.keepassxc.autostart` to be effective.
|
||||||
|
''
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
keepassxc-autostart = ./autostart.nix;
|
||||||
keepassxc-default-settings = ./default-settings.nix;
|
keepassxc-default-settings = ./default-settings.nix;
|
||||||
keepassxc-example-settings = ./example-settings.nix;
|
keepassxc-example-settings = ./example-settings.nix;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue