feat(home): Add pinentry to theme module

This commit is contained in:
punkfairie 2024-11-16 19:12:51 -08:00
parent ab9fef99f7
commit 17113e608c
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696
3 changed files with 42 additions and 27 deletions

View file

@ -2,6 +2,7 @@
lib,
namespace,
config,
pkgs,
...
}:
let
@ -9,6 +10,7 @@ let
types
mkOption
literalMD
mkMerge
mkIf
mkDefault
;
@ -102,21 +104,45 @@ in
default = null;
description = "The icon theme to use.";
};
pinentry = mkOption {
type = with types; package;
default = pkgs.pinentry-gtk2;
description = "The pinentry package to use.";
};
};
config = mkIf (cfg.icons != null) {
gtk = mkIf config.gtk.enable (mkDefault {
iconTheme = {
inherit (cfg.icons) name;
package = mkIf (cfg.icons.package != null) cfg.package;
};
});
config = mkMerge [
# icons
(mkIf (cfg.icons != null) {
gtk = mkIf config.gtk.enable (mkDefault {
iconTheme = {
inherit (cfg.icons) name;
package = mkIf (cfg.icons.package != null) cfg.package;
};
});
services.dunst = mkIf config.services.dunst.enable (mkDefault {
iconTheme = {
inherit (cfg.icons) name;
package = mkIf (cfg.icons.package != null) cfg.package;
};
});
};
services.dunst = mkIf config.services.dunst.enable (mkDefault {
iconTheme = {
inherit (cfg.icons) name;
package = mkIf (cfg.icons.package != null) cfg.package;
};
});
})
# pinentry
{
home.packages = [
cfg.pinentry
];
programs.rbw = mkIf config.programs.rbw.enable (mkDefault {
settings.pinentry = cfg.pinentry;
});
services.gpg-agent = mkIf config.services.gpg-agent.enable (mkDefault {
pinentryPackage = cfg.pinentry;
});
}
];
}

View file

@ -2,12 +2,11 @@
lib,
config,
namespace,
pkgs,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkEnableModule isDesktop;
inherit (lib.${namespace}) mkEnableModule;
cfg = config.${namespace}.programs.gpg;
in
@ -15,12 +14,6 @@ in
options = mkEnableModule "programs.gpg";
config = mkIf cfg.enable {
# home-manager gpg-agent module doesn't seem to actually install the desired
# pinentry program, so we install it here.
home.packages = [
config.services.gpg-agent.pinentryPackage
];
programs.gpg = {
enable = true;
};
@ -28,8 +21,6 @@ in
services.gpg-agent = rec {
enable = true;
pinentryPackage = if isDesktop then pkgs.pinentry-gtk2 else pkgs.pinentry-curses;
# Don't ask for the password very often.
defaultCacheTtl = 60480000;
maxCacheTtl = defaultCacheTtl;

View file

@ -1,10 +1,8 @@
{ pkgs, ... }:
{ _ }:
{
programs.rbw = {
enable = true;
settings.email = "bitwarden@punkfairie.net";
# TODO: set this globally?
settings.pinentry = pkgs.pinentry-gtk2;
};
}