Add git host cli tools
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -41,5 +41,41 @@ in
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "gh";
|
||||
runtimeInputs = with pkgs; [ gh ];
|
||||
text = builtins.readFile ./gh.sh;
|
||||
})
|
||||
(pkgs.writeShellApplication {
|
||||
name = "glab";
|
||||
runtimeInputs = with pkgs; [ glab ];
|
||||
text = builtins.readFile ./glab.sh;
|
||||
})
|
||||
(pkgs.writeShellApplication {
|
||||
name = "tea";
|
||||
runtimeInputs = with pkgs; [ tea ];
|
||||
text = builtins.readFile ./tea.sh;
|
||||
})
|
||||
];
|
||||
|
||||
sessionVariables = {
|
||||
GITEA_HOST = "git.karaolidis.com";
|
||||
GITEA_SSH_HOST = "karaolidis.com";
|
||||
};
|
||||
};
|
||||
|
||||
xdg.configFile = {
|
||||
"gh/config.yml".source = (pkgs.formats.yaml { }).generate "config.yml" {
|
||||
version = 1;
|
||||
git_protocol = "ssh";
|
||||
};
|
||||
|
||||
"glab-cli/config.yml".source = (pkgs.formats.yaml { }).generate "config.yml" {
|
||||
git_protocol = "ssh";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
8
hosts/common/configs/user/console/git/gh.sh
Normal file
8
hosts/common/configs/user/console/git/gh.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
GH_HOST="${GH_HOST:-github.com}"
|
||||
|
||||
GH_TOKEN=$(sed -n "s#https://[^:]*:\([^@]*\)@${GH_HOST}#\1#p" "$HOME/.config/git/credentials")
|
||||
export GH_TOKEN
|
||||
|
||||
exec gh "$@"
|
8
hosts/common/configs/user/console/git/glab.sh
Normal file
8
hosts/common/configs/user/console/git/glab.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
GITLAB_HOST="${GITLAB_HOST:-gitlab.com}"
|
||||
|
||||
GITLAB_TOKEN=$(sed -n "s#https://[^:]*:\([^@]*\)@${GITLAB_HOST}#\1#p" "$HOME/.config/git/credentials")
|
||||
export GITLAB_TOKEN
|
||||
|
||||
exec glab "$@"
|
13
hosts/common/configs/user/console/git/tea.sh
Normal file
13
hosts/common/configs/user/console/git/tea.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
GITEA_HOST="${GITEA_HOST:-gitea.com}"
|
||||
GITEA_SSH_HOST="${GITEA_SSH_HOST:-gitea.com}"
|
||||
|
||||
GITEA_TOKEN=$(sed -n "s#https://[^:]*:\([^@]*\)@${GITEA_HOST}#\1#p" "$HOME/.config/git/credentials")
|
||||
GITEA_INSTANCE_URL="https://${GITEA_HOST}"
|
||||
GITEA_INSTANCE_SSH_HOST="$GITEA_SSH_HOST"
|
||||
export GITEA_TOKEN
|
||||
export GITEA_INSTANCE_URL
|
||||
export GITEA_INSTANCE_SSH_HOST
|
||||
|
||||
exec tea "$@"
|
@@ -20,6 +20,10 @@
|
||||
enable = true;
|
||||
defaultCacheTtl = 31536000;
|
||||
maxCacheTtl = 31536000;
|
||||
pinentry = {
|
||||
package = pkgs.pinentry-all;
|
||||
program = "pinentry-tty";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user = {
|
||||
|
Reference in New Issue
Block a user