diff --git a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
index 5554927b8b2..c723a6dd2ad 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
@@ -232,6 +232,13 @@
services.nats.
+
+
+ git, a
+ distributed version control system. Available as
+ programs.git.
+
+
diff --git a/nixos/doc/manual/release-notes/rl-2111.section.md b/nixos/doc/manual/release-notes/rl-2111.section.md
index 00844d529b7..440069988d0 100644
--- a/nixos/doc/manual/release-notes/rl-2111.section.md
+++ b/nixos/doc/manual/release-notes/rl-2111.section.md
@@ -71,6 +71,8 @@ subsonic-compatible api. Available as [navidrome](#opt-services.navidrome.enable
- [nats](https://nats.io/), a high performance cloud and edge messaging system. Available as [services.nats](#opt-services.nats.enable).
+- [git](https://git-scm.com), a distributed version control system. Available as [programs.git](options.html#opt-programs.git.enable).
+
## Backward Incompatibilities {#sec-release-21.11-incompatibilities}
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 1998a309035..3bc7c01d7ac 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -145,6 +145,7 @@
./programs/fuse.nix
./programs/gamemode.nix
./programs/geary.nix
+ ./programs/git.nix
./programs/gnome-disks.nix
./programs/gnome-documents.nix
./programs/gnome-terminal.nix
diff --git a/nixos/modules/programs/git.nix b/nixos/modules/programs/git.nix
new file mode 100644
index 00000000000..4e06b576f89
--- /dev/null
+++ b/nixos/modules/programs/git.nix
@@ -0,0 +1,45 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.programs.git;
+in
+
+{
+ options = {
+ programs.git = {
+ enable = mkEnableOption "git";
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.git;
+ defaultText = "pkgs.git";
+ example = literalExample "pkgs.gitFull";
+ description = "The git package to use";
+ };
+
+ config = mkOption {
+ type = types.attrs;
+ default = { };
+ example = {
+ init.defaultBranch = "main";
+ url."https://github.com/".insteadOf = [ "gh:" "github:" ];
+ };
+ description = ''
+ Configuration to write to /etc/gitconfig. See the CONFIGURATION FILE
+ section of git-config(1) for more information.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = [ cfg.package ];
+ environment.etc.gitconfig = mkIf (cfg.config != {}) {
+ text = generators.toGitINI cfg.config;
+ };
+ };
+
+ meta.maintainers = with maintainers; [ figsoda ];
+}