Merge pull request #137325 from figsoda/git-module

nixos/git: init
This commit is contained in:
Timothy DeHerrera 2021-09-11 15:42:22 -06:00 committed by GitHub
commit 8e2f255cb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 0 deletions

View File

@ -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">

View File

@ -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}

View File

@ -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

View File

@ -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 ];
}