From 194086df82d235919c1f8da68c4af2490d4675f9 Mon Sep 17 00:00:00 2001 From: Tomo <68489118+Tomodachi94@users.noreply.github.com> Date: Sun, 11 Jun 2023 20:23:46 -0700 Subject: [PATCH] git-credential-oauth: add module --- modules/misc/news.nix | 7 +++++++ modules/modules.nix | 1 + modules/programs/git-credential-oauth.nix | 24 +++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 modules/programs/git-credential-oauth.nix diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 3b0378c9c..cec6a508d 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1094,6 +1094,13 @@ in may be necessary as new modules are added. ''; } + + { + time = "2023-06-14T21:25:34+00:00"; + message = '' + A new module is available: 'programs.git-credential-oauth'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 1d839939f..f9c2be546 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -85,6 +85,7 @@ let ./programs/getmail.nix ./programs/gh.nix ./programs/git-cliff.nix + ./programs/git-credential-oauth.nix ./programs/git.nix ./programs/gitui.nix ./programs/gnome-terminal.nix diff --git a/modules/programs/git-credential-oauth.nix b/modules/programs/git-credential-oauth.nix new file mode 100644 index 000000000..4833e8068 --- /dev/null +++ b/modules/programs/git-credential-oauth.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: + +let + + cfg = config.programs.git-credential-oauth; + +in { + meta.maintainers = [ lib.maintainers.tomodachi94 ]; + + options = { + programs.git-credential-oauth = { + enable = lib.mkEnableOption "Git authentication handler for OAuth"; + + package = lib.mkPackageOption pkgs "git-credential-oauth" { }; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ cfg.package ]; + + programs.git.extraConfig.credential.helper = + [ "${cfg.package}/bin/git-credential-oauth" ]; + }; +}