From a22a3f390bfec62a9978df50500ac397142a93ae Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Sun, 2 Oct 2022 21:53:40 -0400 Subject: [PATCH] Move gpg into home-manager --- home-manager/linux/default.nix | 3 +++ home-manager/linux/programs/gpg.nix | 17 +++++++++++++++++ modules/linux/programs/gpg.nix | 23 ----------------------- 3 files changed, 20 insertions(+), 23 deletions(-) create mode 100644 home-manager/linux/programs/gpg.nix diff --git a/home-manager/linux/default.nix b/home-manager/linux/default.nix index 553f503..b8e28e3 100644 --- a/home-manager/linux/default.nix +++ b/home-manager/linux/default.nix @@ -14,6 +14,7 @@ with lib; with nLib; { ./programs/image-editing.nix ./programs/media.nix ./programs/wine.nix + ./programs/gpg.nix ./services/syncthing.nix ./services/email.nix ]; @@ -36,6 +37,8 @@ with lib; with nLib; { util = { # Wine support, disabled by default wine = mkEnableOption "wine"; + # GPG support, enabled by default on desktop + gpg = mkEnableOptionT "gpg"; }; devel = { jvm = mkDefaultOption "JVM Development Utilites" config.nathan.config.isDesktop; diff --git a/home-manager/linux/programs/gpg.nix b/home-manager/linux/programs/gpg.nix new file mode 100644 index 0000000..58ac688 --- /dev/null +++ b/home-manager/linux/programs/gpg.nix @@ -0,0 +1,17 @@ +{ config, lib, pkgs, ... }: + +{ + config = lib.mkIf config.nathan.programs.util.gpg { + programs.gpg = { + enable = true; + }; + services.gpg-agent = { + enable = true; + enableSshSupport = true; + enableExtraSocket = true; + extraConfig = '' + allow-emacs-pinentry + ''; + }; + }; +} diff --git a/modules/linux/programs/gpg.nix b/modules/linux/programs/gpg.nix index 65c9d6c..a6ae111 100644 --- a/modules/linux/programs/gpg.nix +++ b/modules/linux/programs/gpg.nix @@ -6,29 +6,6 @@ in with lib; { config = mkIf np.gpg { - # Setup environment for gpg agent - environment.shellInit = '' - export GPG_TTY="$(tty)" - gpg-connect-agent /bye - export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" - ''; - - environment.sessionVariables = { - SSH_AUTH_SOCK = - "/run/user/1000/gnupg/S.gpg-agent.ssh"; - }; - - programs = { - # Disable ssh-agent, the gpg-agent will fill in - ssh.startAgent = false; - # Enable gpg-agent with ssh support - gnupg.agent = { - enable = true; - enableSSHSupport = true; - enableExtraSocket = true; - }; - }; - # Enable ykpersonalize to work services.udev.packages = [ pkgs.yubikey-personalization ]; # Enable smartcard service