add protonmail-bridge autostart service
This commit is contained in:
@ -13,33 +13,56 @@ in {
|
|||||||
enable = mkEnableOpt "KeePassXC";
|
enable = mkEnableOpt "KeePassXC";
|
||||||
autostart = mkBoolOpt false "Autostart KeePassXC";
|
autostart = mkBoolOpt false "Autostart KeePassXC";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protonmail = {
|
||||||
|
enable = mkEnableOpt "ProtonMail";
|
||||||
|
autostart = mkBoolOpt false "Autostart ProtonMail Bridge";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
home.packages = with pkgs; builtins.concatLists [
|
home.packages = with pkgs; builtins.concatLists [
|
||||||
(optionals cfg.keepass.enable [ keepassxc ])
|
(optionals cfg.keepass.enable [ keepassxc ])
|
||||||
|
(optionals cfg.protonmail.enable [ protonmail-bridge ])
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.user.services = {
|
systemd.user.services = mkMerge [
|
||||||
autostart-keepass =
|
(optionalAttrs (cfg.keepass.enable && cfg.keepass.autostart) {
|
||||||
(mkIf (cfg.keepass.enable && cfg.keepass.autostart) {
|
autostart-keepass = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
Description = "KeePassXC password manager";
|
Description = "KeePassXC password manager";
|
||||||
PartOf = [ "graphical-session.target" ];
|
PartOf = [ "graphical-session.target" ];
|
||||||
After = [ "graphical-session.target" ];
|
After = [ "graphical-session.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
Environment = "PATH=${config.home.profileDirectory}/bin"; # Leads to /etc/profiles/per-user/christoph/bin
|
# Environment = "PATH=${config.home.profileDirectory}/bin"; # Leads to /etc/profiles/per-user/christoph/bin
|
||||||
ExecStart = "${pkgs.keepassxc}/bin/keepassxc ${config.home.homeDirectory}/Documents/KeePass/passwords.kbdx";
|
ExecStart = "${pkgs.keepassxc}/bin/keepassxc ${config.home.homeDirectory}/Documents/KeePass/passwords.kbdx";
|
||||||
# ExecStop = "${pkgs.noisetorch}/bin/noisetorch -u";
|
# ExecStop = "${pkgs.noisetorch}/bin/noisetorch -u";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
};
|
};
|
||||||
|
|
||||||
Install.WantedBy = [ "graphical-session.target" ];
|
Install.WantedBy = [ "graphical-session.target" ];
|
||||||
});
|
};
|
||||||
};
|
})
|
||||||
|
|
||||||
|
(optionalAttrs (cfg.protonmail.enable && cfg.protonmail.autostart) {
|
||||||
|
autostart-protonmail = {
|
||||||
|
Unit = {
|
||||||
|
Description = "ProtonMail Bridge";
|
||||||
|
After = [ "network.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
ExecStart = "${pkgs.protonmail-bridge}/bin/protonmail-bridge --no-window --log-level info --noninteractive";
|
||||||
|
Restart = "always";
|
||||||
|
};
|
||||||
|
|
||||||
|
Install.WantedBy = [ "default.target" ];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user