about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--modules/workstation/default.nix2
-rw-r--r--modules/workstation/gh/default.nix21
2 files changed, 22 insertions, 1 deletions
diff --git a/modules/workstation/default.nix b/modules/workstation/default.nix
index c444ef320845..a6081ac12ee5 100644
--- a/modules/workstation/default.nix
+++ b/modules/workstation/default.nix
@@ -3,7 +3,7 @@
 {
   imports = [
     ../nix ../shell ../users ../ssh
-    ./documentation ./windowing ./fonts ./hardware ./locale
+    ./documentation ./windowing ./fonts ./gh ./hardware ./locale
     ./dict ./dino ./emacs ./gnupg ./lorri ./mail ./mpv ./weechat
   ];
 
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) ];
+}