From 0e437c29de4c5870bd6b0a537586feab824e4adb Mon Sep 17 00:00:00 2001 From: Fabrizio Romano Genovese Date: Tue, 16 Dec 2025 14:40:39 +0100 Subject: [PATCH] Trying to make this thingy work. --- modules/home-manager/sops.nix | 12 +++++++++++- modules/nix-darwin/default.nix | 2 +- modules/sops/default.nix | 12 +++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/modules/home-manager/sops.nix b/modules/home-manager/sops.nix index 4906b4c..d32514d 100644 --- a/modules/home-manager/sops.nix +++ b/modules/home-manager/sops.nix @@ -269,6 +269,16 @@ in }; gnupg = { + package = lib.mkOption { + type = lib.types.package; + default = pkgs.gnupg; + defaultText = lib.literalExpression "pkgs.gnupg"; + description = '' + The gnupg package to use for sops operations. + Useful if you need a specific version or a wrapped instance. + ''; + }; + home = lib.mkOption { type = lib.types.nullOr lib.types.str; default = null; @@ -341,7 +351,7 @@ in sops.environment = { SOPS_GPG_EXEC = lib.mkMerge [ (lib.mkIf (cfg.gnupg.home != null || cfg.gnupg.sshKeyPaths != [ ]) ( - lib.mkDefault "${pkgs.gnupg}/bin/gpg" + lib.mkDefault "${cfg.gnupg.package}/bin/gpg" )) (lib.mkIf cfg.gnupg.qubes-split-gpg.enable ( lib.mkDefault config.home.sessionVariables.SOPS_GPG_EXEC diff --git a/modules/nix-darwin/default.nix b/modules/nix-darwin/default.nix index f169a30..57e9e05 100644 --- a/modules/nix-darwin/default.nix +++ b/modules/nix-darwin/default.nix @@ -384,7 +384,7 @@ in { sops.environment.SOPS_GPG_EXEC = lib.mkIf (cfg.gnupg.home != null || cfg.gnupg.sshKeyPaths != [ ]) ( - lib.mkDefault "${pkgs.gnupg}/bin/gpg" + lib.mkDefault "${cfg.gnupg.package}/bin/gpg" ); } ]; diff --git a/modules/sops/default.nix b/modules/sops/default.nix index 0c236d5..c6c5fcb 100644 --- a/modules/sops/default.nix +++ b/modules/sops/default.nix @@ -381,6 +381,16 @@ in This option must be explicitly unset if config.sops.gnupg.home is set. ''; }; + + package = lib.mkOption { + type = lib.types.package; + default = pkgs.gnupg; + defaultText = lib.literalExpression "pkgs.gnupg"; + description = '' + The gnupg package to use for sops operations. + ''; + }; + }; }; imports = [ @@ -442,7 +452,7 @@ in ); sops.environment.SOPS_GPG_EXEC = lib.mkIf (cfg.gnupg.home != null || cfg.gnupg.sshKeyPaths != [ ]) ( - lib.mkDefault "${pkgs.gnupg}/bin/gpg" + lib.mkDefault "${cfg.gnupg.package}/bin/gpg" ); # When using sysusers we no longer are started as an activation script because those are started in initrd while sysusers is started later.