summaryrefslogtreecommitdiffstats
path: root/nixos
diff options
context:
space:
mode:
authorfigsoda <figsoda@pm.me>2021-09-10 18:46:48 -0400
committerfigsoda <figsoda@pm.me>2021-09-10 18:50:04 -0400
commit44853e8cf338e9b42c1d3069287b9655658325bb (patch)
treea87cba05bd5b58e360132f05e54b34f0e47b6b9b /nixos
parent6e4c36b3f7ec1400bd92ef42567b687f20f3c3c4 (diff)
nixos/git: init
Diffstat (limited to 'nixos')
-rw-r--r--nixos/doc/manual/from_md/release-notes/rl-2111.section.xml7
-rw-r--r--nixos/doc/manual/release-notes/rl-2111.section.md2
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/programs/git.nix45
4 files changed, 55 insertions, 0 deletions
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 5554927b8b2a..c723a6dd2add 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 @@
<link linkend="opt-services.nats.enable">services.nats</link>.
</para>
</listitem>
+ <listitem>
+ <para>
+ <link xlink:href="https://git-scm.com">git</link>, a
+ distributed version control system. Available as
+ <link xlink:href="options.html#opt-programs.git.enable">programs.git</link>.
+ </para>
+ </listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-21.11-incompatibilities">
diff --git a/nixos/doc/manual/release-notes/rl-2111.section.md b/nixos/doc/manual/release-notes/rl-2111.section.md
index 00844d529b77..440069988d0c 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 1998a309035b..3bc7c01d7ac0 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 000000000000..4e06b576f896
--- /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 ];
+}