flake

Francesco Saccone's Nix flake.
git clone https://git.francescosaccone.com/flake
Log | Files | Refs | README | LICENSE

default.nix (932B)


      1 {
      2   lib,
      3   options,
      4   config,
      5   pkgs,
      6   ...
      7 }:
      8 {
      9   options.modules.git = {
     10     enable = lib.mkOption {
     11       description = "Whether to enable Git.";
     12       default = false;
     13       type = lib.types.bool;
     14     };
     15     name = lib.mkOption {
     16       description = "The name used in commits.";
     17       type = lib.types.uniq lib.types.str;
     18     };
     19     email = lib.mkOption {
     20       description = "The email used in commits.";
     21       type = lib.types.uniq lib.types.str;
     22     };
     23   };
     24 
     25   config = lib.mkIf config.modules.git.enable {
     26     programs.git = {
     27       enable = true;
     28       package = pkgs.git;
     29 
     30       userName = config.modules.git.name;
     31       userEmail = config.modules.git.email;
     32       signing = lib.mkIf config.modules.gpg.enable {
     33         key = config.modules.gpg.primaryKey.fingerprint;
     34         signByDefault = true;
     35       };
     36 
     37       extraConfig = {
     38         init.defaultBranch = "master";
     39         pull.rebase = false;
     40       };
     41     };
     42   };
     43 }