1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-01 04:23:34 +02:00
home-manager/modules/programs/git-credential-oauth.nix
Tomo 0482a66a21 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.
2024-04-09 18:29:45 -07:00

38 lines
977 B
Nix

{ 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" { };
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 {
home.packages = [ cfg.package ];
programs.git.extraConfig.credential.helper = [
("${cfg.package}/bin/git-credential-oauth" + lib.mkIf cfg.extraFlags
" ${lib.strings.concatStringsSep " " cfg.extraFlags}")
];
};
}