about summary refs log tree commit diff
path: root/modules/workstation/gh/default.nix
blob: b3dc60ed940750bd7c41927cedd3afe14c2d337e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{ lib, pkgs, ... }:

let
  wrapper = with pkgs; writeScriptBin "gh" ''
    #! ${execline}/bin/execlineb -s0

    fdmove 3 0
    pipeline { ${pass}/bin/pass show api.github.com }
    fdswap 0 3
    export GH_TOKEN_FD 3

    importas -i config_home XDG_CONFIG_HOME
    export GH_CONFIG_DIR ''${config_home}/gh

    ${pkgs.gh}/bin/gh $@
  '';
in

{
  environment.systemPackages = [ pkgs.gh (lib.hiPrio wrapper) ];
}