about summary refs log tree commit diff
path: root/modules/common/gnupg.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
committerAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
commit9a5427e3a0c0ccf2a82dc503149a26b23fbd6004 (patch)
treef28beec29deeea36038615a8fb98a810891940b5 /modules/common/gnupg.nix
parent2024-03-19 (diff)
2024-03-31
Diffstat (limited to '')
-rw-r--r--modules/common/gnupg.nix68
1 files changed, 41 insertions, 27 deletions
diff --git a/modules/common/gnupg.nix b/modules/common/gnupg.nix
index c0f10f9..b32d94c 100644
--- a/modules/common/gnupg.nix
+++ b/modules/common/gnupg.nix
@@ -1,11 +1,9 @@
-{
-  config,
-  lib,
-  ...
-}:
-with lib; let
+{ config, lib, ... }:
+with lib;
+let
   cfg = config.nixfiles.modules.gnupg;
-in {
+in
+{
   options.nixfiles.modules.gnupg.enable = mkEnableOption "GnuPG";
 
   config = mkIf cfg.enable {
@@ -33,26 +31,42 @@ in {
           list-options = "show-uid-validity";
           verify-options = "show-uid-validity";
         }
-        // (let
-          cipherAlgos = ["AES256" "AES192" "AES"];
-          digestAlgos = ["SHA512" "SHA384" "SHA256" "SHA224"];
-          compressionAlgos = ["ZLIB" "BZIP2" "ZIP" "Uncompressed"];
-
-          cs = concatStringsSep " ";
-        in {
-          default-preference-list =
-            cs (cipherAlgos ++ digestAlgos ++ compressionAlgos);
-
-          personal-cipher-preferences = cs cipherAlgos;
-          personal-digest-preferences = cs digestAlgos;
-          personal-compress-preferences = cs compressionAlgos;
-
-          s2k-cipher-algo = head cipherAlgos;
-          s2k-digest-algo = head digestAlgos;
-
-          digest-algo = head digestAlgos;
-          cert-digest-algo = head digestAlgos;
-        });
+        // (
+          let
+            cipherAlgos = [
+              "AES256"
+              "AES192"
+              "AES"
+            ];
+            digestAlgos = [
+              "SHA512"
+              "SHA384"
+              "SHA256"
+              "SHA224"
+            ];
+            compressionAlgos = [
+              "ZLIB"
+              "BZIP2"
+              "ZIP"
+              "Uncompressed"
+            ];
+
+            cs = concatStringsSep " ";
+          in
+          {
+            default-preference-list = cs (cipherAlgos ++ digestAlgos ++ compressionAlgos);
+
+            personal-cipher-preferences = cs cipherAlgos;
+            personal-digest-preferences = cs digestAlgos;
+            personal-compress-preferences = cs compressionAlgos;
+
+            s2k-cipher-algo = head cipherAlgos;
+            s2k-digest-algo = head digestAlgos;
+
+            digest-algo = head digestAlgos;
+            cert-digest-algo = head digestAlgos;
+          }
+        );
     };
   };
 }

Consider giving Nix/NixOS a try! <3