2022-08-14 23:35:15 +00:00
|
|
|
{ config, lib, pkgs, user, ... }:
|
2022-03-24 02:37:20 +00:00
|
|
|
let
|
2022-08-14 02:42:16 +00:00
|
|
|
this = config.my.application.onepassword;
|
2022-08-14 02:42:04 +00:00
|
|
|
graphical = config.my.graphical;
|
2022-08-14 02:42:16 +00:00
|
|
|
enable = (this.gui.enable || this.cli.enable);
|
2022-08-14 23:35:15 +00:00
|
|
|
in
|
|
|
|
with lib; {
|
2022-03-24 02:37:20 +00:00
|
|
|
options = {
|
2022-08-14 02:42:04 +00:00
|
|
|
my.application.onepassword.gui.enable = mkOption {
|
2022-03-24 02:37:20 +00:00
|
|
|
default = graphical.enable;
|
|
|
|
type = with types; bool;
|
|
|
|
};
|
2022-08-14 02:42:04 +00:00
|
|
|
my.application.onepassword.cli.enable = mkOption {
|
2022-08-14 02:42:16 +00:00
|
|
|
default = (graphical.enable || this.gui.enable);
|
2022-03-24 02:37:20 +00:00
|
|
|
type = with types; bool;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-03-24 23:39:48 +00:00
|
|
|
config = mkIf enable (mkMerge [
|
2022-08-14 02:42:16 +00:00
|
|
|
(mkIf this.cli.enable {
|
2022-08-14 23:35:15 +00:00
|
|
|
home-manager.users."${user.name}".home.packages = with pkgs; [ _1password ];
|
2022-03-24 23:39:48 +00:00
|
|
|
})
|
2022-08-14 02:42:16 +00:00
|
|
|
(mkIf this.gui.enable {
|
2022-08-14 23:35:15 +00:00
|
|
|
home-manager.users."${user.name}" = {
|
2022-03-24 23:39:48 +00:00
|
|
|
home.packages = with pkgs; [ _1password-gui ];
|
|
|
|
};
|
|
|
|
systemd.user.services._1password = {
|
|
|
|
enable = true;
|
|
|
|
description = "1password for linux. (PAM not included)";
|
|
|
|
wantedBy = [ "graphical-session.target" ];
|
|
|
|
partOf = [ "graphical-session.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${pkgs._1password-gui}/bin/1password --silent";
|
|
|
|
RestartSec = 5;
|
|
|
|
Restart = "always";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
]);
|
2022-03-24 02:37:20 +00:00
|
|
|
}
|