feat: git commit signing
This commit is contained in:
2 files changed
+26
No files matched your search
@@ -28,6 +28,18 @@ in
|
||||
default = [ ];
|
||||
description = "Paths to globally ignore";
|
||||
};
|
||||
|
||||
signingKey = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Path to the SSH public key used to sign commits and tags.";
|
||||
};
|
||||
|
||||
allowedSigners = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "Trusted signers for verifying SSH signatures, as \"<email> <public key>\" lines.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
@@ -48,6 +60,16 @@ in
|
||||
settings.user.name = cfg.user;
|
||||
settings.user.email = cfg.email;
|
||||
ignores = cfg.ignores;
|
||||
|
||||
signing = mkIf (cfg.signingKey != null) {
|
||||
format = "ssh";
|
||||
key = cfg.signingKey;
|
||||
signByDefault = true; # commit.gpgsign and tag.gpgSign
|
||||
};
|
||||
|
||||
settings.gpg.ssh.allowedSignersFile = mkIf (cfg.allowedSigners != [ ]) (
|
||||
toString (pkgs.writeText "git-allowed-signers" (concatLines cfg.allowedSigners))
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user