aboutsummaryrefslogtreecommitdiffstats
path: root/modules/development/git/assertions.nix
blob: 1dd1cf5b8d6b5d703b4b79cc280771098f5632ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Validates SSH is enabled when git.useSSH is set
{ config, ... }:
let
  cfg = config.development.git;
in
{
  assertions = [
    {
      assertion = !cfg.signing.sign-by-default || cfg.enable;
      message = ''
        development.git.signing.sign-by-default is enabled but development.git.enable is not.
        Enable development.git before enabling commit signing.
      '';
    }
    {
      assertion = !cfg.signing.sign-by-default || cfg.signing.key != null;
      message = ''
        development.git.signing.sign-by-default is enabled but development.git.signing.key is not set.
        Set a GPG key ID before enabling commit signing by default.
      '';
    }
    {
      assertion = !cfg.signing.sign-by-default || config.security.gpg.enable;
      message = ''
        development.git.signing.sign-by-default is enabled but security.gpg.enable is not.
        Commit signing requires the managed GPG configuration. Please enable security.gpg.
      '';
    }
  ];
}