diff --git a/modules/home/keepassxc/home-keepassxc-autostart.ulu.nix b/modules/home/keepassxc/home-keepassxc-autostart.ulu.nix new file mode 100644 index 0000000..66d041b --- /dev/null +++ b/modules/home/keepassxc/home-keepassxc-autostart.ulu.nix @@ -0,0 +1,29 @@ +{ ... }: +{ + flake.homeModules.home-keepassxc-autostart = + { config, ... }: + { + programs.keepassxc.settings.GUI = { + ShowTrayIcon = true; + MinimizeToTray = true; + MinimizeOnClose = true; + }; + + systemd.user.services.keepassxc = { + Unit = { + Description = "KeePassXC"; + PartOf = [ "graphical-session.target" ]; + After = [ + "graphical-session.target" + "rclone-gdrive.service" + ]; + Wants = [ "rclone-gdrive.service" ]; + }; + Service = { + ExecStart = "${config.programs.keepassxc.package}/bin/keepassxc --minimized"; + Restart = "on-failure"; + }; + Install.WantedBy = [ "graphical-session.target" ]; + }; + }; +} diff --git a/modules/home/keepassxc/home-keepassxc-helium.ulu.nix b/modules/home/keepassxc/home-keepassxc-helium.ulu.nix new file mode 100644 index 0000000..26b67b6 --- /dev/null +++ b/modules/home/keepassxc/home-keepassxc-helium.ulu.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + flake.homeModules.home-keepassxc-helium = + { config, ... }: + { + xdg.configFile."net.imput.helium/NativeMessagingHosts/org.keepassxc.keepassxc_browser.json".source = + "${config.programs.keepassxc.package}/etc/chromium/native-messaging-hosts/org.keepassxc.keepassxc_browser.json"; + }; +} diff --git a/modules/home/keepassxc/home-keepassxc-mutable-config.ulu.nix b/modules/home/keepassxc/home-keepassxc-mutable-config.ulu.nix new file mode 100644 index 0000000..fff2626 --- /dev/null +++ b/modules/home/keepassxc/home-keepassxc-mutable-config.ulu.nix @@ -0,0 +1,27 @@ +{ ... }: +{ + flake.homeModules.home-keepassxc-mutable-config = + { + config, + lib, + pkgs, + ... + }: + let + cfg = config.programs.keepassxc; + ini = "${config.xdg.configHome}/keepassxc/keepassxc.ini"; + declared = (pkgs.formats.ini { }).generate "keepassxc-declared.ini" cfg.settings; + in + { + xdg.configFile."keepassxc/keepassxc.ini".enable = lib.mkForce false; + + home.activation.keepassxcConfig = lib.hm.dag.entryAfter [ "linkGeneration" ] '' + if [ -L ${ini} ]; then + run rm ${ini} + fi + run mkdir -p ${config.xdg.configHome}/keepassxc + run touch ${ini} + run ${pkgs.crudini}/bin/crudini --merge ${ini} < ${declared} + ''; + }; +} diff --git a/modules/home/keepassxc/home-keepassxc.ulu.nix b/modules/home/keepassxc/home-keepassxc.ulu.nix new file mode 100644 index 0000000..19b5912 --- /dev/null +++ b/modules/home/keepassxc/home-keepassxc.ulu.nix @@ -0,0 +1,21 @@ +{ ... }: +{ + flake.homeModules.home-keepassxc = + { ... }: + { + programs.keepassxc = { + enable = true; + settings = { + Browser = { + Enabled = true; + UpdateBinaryPath = false; + }; + Security = { + LockDatabaseIdle = true; + LockDatabaseIdleSeconds = 900; + ClearClipboardTimeout = 20; + }; + }; + }; + }; +}