feat: git commit signing
This commit is contained in:
2 files changed
+26
No files matched your search
@@ -28,6 +28,18 @@ in
|
|||||||
default = [ ];
|
default = [ ];
|
||||||
description = "Paths to globally ignore";
|
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 {
|
config = mkIf cfg.enable {
|
||||||
@@ -48,6 +60,16 @@ in
|
|||||||
settings.user.name = cfg.user;
|
settings.user.name = cfg.user;
|
||||||
settings.user.email = cfg.email;
|
settings.user.email = cfg.email;
|
||||||
ignores = cfg.ignores;
|
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))
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -264,6 +264,10 @@ in
|
|||||||
enable = true;
|
enable = true;
|
||||||
user = "Jan-Bulthuis";
|
user = "Jan-Bulthuis";
|
||||||
email = "git@bulthuis.dev";
|
email = "git@bulthuis.dev";
|
||||||
|
signingKey = "${config.home.homeDirectory}/.ssh/id_ed25519.pub";
|
||||||
|
allowedSigners = [
|
||||||
|
"git@bulthuis.dev ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKKxoQSxfYqf9ITN8Fhckk8WbY4dwtBAXOhC9jxihJvq"
|
||||||
|
];
|
||||||
# TODO: Move
|
# TODO: Move
|
||||||
ignores = [
|
ignores = [
|
||||||
".envrc"
|
".envrc"
|
||||||
|
|||||||
Reference in new issue
Block a user