nixos-config/users/simon/modules/gpg.nix

44 lines
1.1 KiB
Nix

# SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ lib, nixosConfig, pkgs, ... }:
{
programs.gpg = {
enable = true;
settings = {
default-key = "D48A1ACAB1CDBD170151662BB1A0B4A45885A031";
keyid-format = "none";
with-fingerprint = false;
with-subkey-fingerprint = true;
};
};
services.gpg-agent = rec {
enable = true;
enableZshIntegration = true;
enableSshSupport = lib.mkDefault nixosConfig.sbruder.gui.enable;
pinentryFlavor = if nixosConfig.sbruder.gui.enable then "gnome3" else "curses";
defaultCacheTtl = 300;
defaultCacheTtlSsh = defaultCacheTtl;
maxCacheTtl = 1800;
maxCacheTtlSsh = maxCacheTtl;
};
systemd.user.services.yubikey-touch-detector = {
Unit.PartOf = [ "sway-session.target" ];
Install.WantedBy = [ "sway-session.target" ];
Service = {
Environment = [
"PATH=${pkgs.gnupg}/bin"
];
ExecStart = "${pkgs.yubikey-touch-detector}/bin/yubikey-touch-detector -libnotify";
Restart = "on-failure";
};
};
}