about summary refs log tree commit diff
path: root/modules/workstation/gh/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/workstation/gh/default.nix')
-rw-r--r--modules/workstation/gh/default.nix21
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/workstation/gh/default.nix b/modules/workstation/gh/default.nix
new file mode 100644
index 000000000000..b3dc60ed9407
--- /dev/null
+++ b/modules/workstation/gh/default.nix
@@ -0,0 +1,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) ];
+}