d7e2c0a924
Will this ever change? No like likely, but I do think that this is the correct way to do this.
41 lines
1.2 KiB
Nix
41 lines
1.2 KiB
Nix
{ config, lib, pkgs, user, ... }:
|
|
let
|
|
this = config.my.application.onepassword;
|
|
graphical = config.my.graphical;
|
|
enable = (this.gui.enable || this.cli.enable);
|
|
in
|
|
with lib; {
|
|
options = {
|
|
my.application.onepassword.gui.enable = mkOption {
|
|
default = graphical.enable;
|
|
type = with types; bool;
|
|
};
|
|
my.application.onepassword.cli.enable = mkOption {
|
|
default = (graphical.enable || this.gui.enable);
|
|
type = with types; bool;
|
|
};
|
|
};
|
|
|
|
config = mkIf enable (mkMerge [
|
|
(mkIf this.cli.enable {
|
|
home-manager.users."${user.name}".home.packages = with pkgs; [ _1password ];
|
|
})
|
|
(mkIf this.gui.enable {
|
|
home-manager.users."${user.name}" = {
|
|
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";
|
|
};
|
|
};
|
|
})
|
|
]);
|
|
}
|