1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

git-credential-oauth: add extraFlags option

This facilitates a legitimate use-case for browserless systems. From the
README:
> On systems without a web browser, set the -device flag to authenticate
> on another device using [OAuth device flow]:
> ```ini
  [credential]
	  helper = cache --timeout 7200	# two hours
	  helper = oauth -device
  ```

[OAuth device flow]: https://www.rfc-editor.org/rfc/rfc8628

Please note that, for the documentation about the man-page to be
accurate, https://github.com/NixOS/nixpkgs/pull/302922 must be merged.
This commit is contained in:
Tomo 2024-10-25 06:56:37 -07:00 committed by GitHub
parent 6cc03e337a
commit c0e2315987
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,13 +12,26 @@ in {
enable = lib.mkEnableOption "Git authentication handler for OAuth"; enable = lib.mkEnableOption "Git authentication handler for OAuth";
package = lib.mkPackageOption pkgs "git-credential-oauth" { }; package = lib.mkPackageOption pkgs "git-credential-oauth" { };
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)`.
'';
};
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
programs.git.extraConfig.credential.helper = programs.git.extraConfig.credential.helper = [
[ "${cfg.package}/bin/git-credential-oauth" ]; ("${cfg.package}/bin/git-credential-oauth" + lib.mkIf cfg.extraFlags
" ${lib.strings.concatStringsSep " " cfg.extraFlags}")
];
}; };
} }