From 8821e4aeaa80f6da233cc695abfad0dded5fd312 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sat, 23 Oct 2021 11:57:55 -0300 Subject: [PATCH] allows for specifying the public key directly This makes it possible to use in pure mode --- module.nix | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/module.nix b/module.nix index d315520..8550ed1 100644 --- a/module.nix +++ b/module.nix @@ -21,7 +21,7 @@ in type = types.nullOr types.path; default = null; description = '' - The private key to sign the derivations with. + File containing the private key to sign the derivations with. ''; }; @@ -29,7 +29,15 @@ in type = types.nullOr types.path; default = null; description = '' - The private key to sign the derivations with. + File containing the public key to sign the derivations with. + ''; + }; + + publicKey = lib.mkOption { + type = types.nullOr types.path; + default = null; + description = '' + The public key to sign the derivations with. ''; }; @@ -132,9 +140,10 @@ in binaryCaches = [ "http://127.0.0.1:12304/" ]; - binaryCachePublicKeys = lib.mkIf (cfg.publicKeyFile != null) [ - (builtins.readFile cfg.publicKeyFile) - ]; + binaryCachePublicKeys = [ + lib.mkIf (cfg.publicKeyFile != null) (builtins.readFile cfg.publicKeyFile) + lib.mkIf (cfg.publicKey != null) cfg.publicKey + ]; extraOptions = lib.mkIf (cfg.globalCacheTTL != null) '' narinfo-cache-negative-ttl = ${toString cfg.globalCacheTTL}