KeepassXC: configure keepass and set up autostart

This commit is contained in:
Toast 2023-06-28 14:30:54 +02:00
parent 25ca3bb7cc
commit ded324e0f3

View file

@ -1,4 +1,25 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
let
kpxcSettings = lib.generators.toINI {} {
# Not sure what changing this does, I'll leave it alone
General = {
ConfigVersion = 2;
MinimizeAfterUnlock = true;
};
GUI = {
ApplicationTheme = "classic";
MinimizeOnStartup = false;
MinimizeOnClose = true;
MinimizeToTray = true;
ShowTrayIcon = true;
# 0 is icons, 1 is text, 2 is text next to icons, 3 is text under icons, and 4 is follow style
ToolButtonStyle = 0; # Would choose 4 but it's too big for a small window
# monochrome-light, monochrome-dark or colorful
TrayIconAppearance = "monochrome-light";
};
};
in
{
# I'm only using keepass on my user, so I'm installing it with home-manager
@ -10,11 +31,38 @@
*/
backupFileExtension = "backup";
useGlobalPkgs = true;
users.toast = { config, pkgs, ... }: {
extraSpecialArgs = { kpxcSettings = kpxcSettings; };
users.toast = { config, pkgs, kpxcSettings, ... }: {
home = {
stateVersion = "23.05";
packages = [ pkgs.keepassxc ];
# No module for KeePassXC config :(
file = {
".config/keepassxc/keepassxc.ini".text = kpxcSettings;
# For some reason the autostart .desktop is not the same as the regular one
".config/autostart/org.keepassxc.KeePassXC.desktop".text = ''
[Desktop Entry]
Name=KeePassXC
GenericName=Password Manager
Exec=keepassxc
TryExec=keepassxc
Icon=keepassxc
StartupWMClass=keepassxc
StartupNotify=true
Terminal=false
Type=Application
Version=1.0
Categories=Utility;Security;Qt;
MimeType=application/x-keepass2;
X-GNOME-Autostart-enabled=true
X-GNOME-Autostart-Delay=2
X-KDE-autostart-after=panel
X-LXQt-Need-Tray=true
'';
};
};
};
};
}