Converted gpg from nixos module to home module
This commit is contained in:
		
							parent
							
								
									726ace8ade
								
							
						
					
					
						commit
						92ec5a59fd
					
				
					 6 changed files with 46 additions and 48 deletions
				
			
		| 
						 | 
				
			
			@ -16,6 +16,7 @@
 | 
			
		|||
 | 
			
		||||
    programs = {
 | 
			
		||||
      firefox.enable = true;
 | 
			
		||||
      gpg.enable = true;
 | 
			
		||||
      kitty.enable = true;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										44
									
								
								modules/home/programs/gpg/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								modules/home/programs/gpg/default.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,44 @@
 | 
			
		|||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  namespace,
 | 
			
		||||
  system,
 | 
			
		||||
  ...
 | 
			
		||||
}: let
 | 
			
		||||
  inherit (lib) mkIf mkEnableOption;
 | 
			
		||||
 | 
			
		||||
  cfg = config.${namespace}.programs.gpg;
 | 
			
		||||
in {
 | 
			
		||||
  options.${namespace}.programs.gpg = {
 | 
			
		||||
    enable = mkEnableOption "gpg";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = mkIf cfg.enable {
 | 
			
		||||
    programs.gpg = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
      scdaemonSettings = {
 | 
			
		||||
        # Fix conflicts with config in common/yubikey.nix
 | 
			
		||||
        disable-ccid = true;
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    programs.ssh.matchBlocks = {
 | 
			
		||||
      # Fix for pinentry showing up in wrong terminal
 | 
			
		||||
      "*".match = "host * exec \"gpg-connect-agent UPDATESTARTUPTTY /bye\"";
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # gpg-agent configuration does not work on darwin
 | 
			
		||||
    # see here: https://github.com/nix-community/home-manager/issues/3864
 | 
			
		||||
    services.gpg-agent = mkIf (system == "x86_64-linux") {
 | 
			
		||||
      enable = true;
 | 
			
		||||
      pinentryPackage = pkgs.pinentry-curses;
 | 
			
		||||
      enableZshIntegration = true;
 | 
			
		||||
      enableSshSupport = true;
 | 
			
		||||
      sshKeys = [
 | 
			
		||||
        # run `gpg-connect-agent 'keyinfo --list' /bye` to get these values for existing keys
 | 
			
		||||
        "E274D5078327CB6C8C83CFF102CC12A2D493C77F"
 | 
			
		||||
      ];
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -13,10 +13,6 @@ in {
 | 
			
		|||
 | 
			
		||||
  config = mkIf cfg.enable {
 | 
			
		||||
    aa = {
 | 
			
		||||
      tools = {
 | 
			
		||||
        gpg.enable = true;
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      apps = {
 | 
			
		||||
        neovim.enable = true;
 | 
			
		||||
      };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,6 +24,7 @@ in {
 | 
			
		|||
        du-dust
 | 
			
		||||
        fd
 | 
			
		||||
        file
 | 
			
		||||
        gnupg
 | 
			
		||||
        htop
 | 
			
		||||
        jq
 | 
			
		||||
        killall
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,43 +0,0 @@
 | 
			
		|||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
with lib; let
 | 
			
		||||
  cfg = config.aa.tools.gpg;
 | 
			
		||||
in {
 | 
			
		||||
  options.aa.tools.gpg = with types; {
 | 
			
		||||
    enable = mkEnableOption "gpg";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = mkIf cfg.enable {
 | 
			
		||||
    environment.systemPackages = [pkgs.gnupg ];
 | 
			
		||||
 | 
			
		||||
    aa.home.extraOptions = {
 | 
			
		||||
      programs.gpg = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
        scdaemonSettings = {
 | 
			
		||||
          # Fix conflicts with config in common/yubikey.nix
 | 
			
		||||
          disable-ccid = true;
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      programs.ssh.matchBlocks = {
 | 
			
		||||
        # Fix for pinentry showing up in wrong terminal
 | 
			
		||||
        "*".match = "host * exec \"gpg-connect-agent UPDATESTARTUPTTY /bye\"";
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      services.gpg-agent = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
        pinentryPackage = pkgs.pinentry-curses;
 | 
			
		||||
        enableZshIntegration = true; # TODO: Only set if using zsh
 | 
			
		||||
        enableSshSupport = true;
 | 
			
		||||
        sshKeys = [
 | 
			
		||||
          # run `gpg-connect-agent 'keyinfo --list' /bye` to get these values for existing keys
 | 
			
		||||
          "E274D5078327CB6C8C83CFF102CC12A2D493C77F"
 | 
			
		||||
        ];
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -83,7 +83,6 @@
 | 
			
		|||
 | 
			
		||||
    suites.utils.enable = true;
 | 
			
		||||
 | 
			
		||||
    tools.gpg.enable = true;
 | 
			
		||||
    apps.yubikey.enable = true;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue