2023-06-12 05:23:46 +02:00
|
|
|
{ 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" { };
|
2024-10-25 15:56:37 +02:00
|
|
|
|
|
|
|
extraFlags = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.str;
|
|
|
|
default = [ ];
|
|
|
|
example = lib.literalExpression ''[ "-device" ]'';
|
|
|
|
description = ''
|
|
|
|
Extra command-line arguments passed to git-credential-oauth.
|
|
|
|
|
|
|
|
For valid arguments, see {manpage}`git-credential-oauth(1)`.
|
|
|
|
'';
|
|
|
|
};
|
2023-06-12 05:23:46 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
2024-10-25 15:56:37 +02:00
|
|
|
programs.git.extraConfig.credential.helper = [
|
2024-10-27 07:45:32 +01:00
|
|
|
("${cfg.package}/bin/git-credential-oauth"
|
|
|
|
+ lib.optionalString (cfg.extraFlags != [ ])
|
2024-10-25 15:56:37 +02:00
|
|
|
" ${lib.strings.concatStringsSep " " cfg.extraFlags}")
|
|
|
|
];
|
2023-06-12 05:23:46 +02:00
|
|
|
};
|
|
|
|
}
|