feat: git commit signing

This commit is contained in:
Jan-Bulthuis committed 2026-10-30 20:14:32 +01:00
1 parent d3c6f9b1d1
commit 12a61ac093
2 files changed
+26

No files matched your search

+22
View File
@@ -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))
);
};
};
}
+4
View File
@@ -264,6 +264,10 @@ in
enable = true;
user = "Jan-Bulthuis";
email = "git@bulthuis.dev";
signingKey = "${config.home.homeDirectory}/.ssh/id_ed25519.pub";
allowedSigners = [
"git@bulthuis.dev ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKKxoQSxfYqf9ITN8Fhckk8WbY4dwtBAXOhC9jxihJvq"
];
# TODO: Move
ignores = [
".envrc"