Skip to content

Commit

Permalink
Configure GitLab cli
Browse files Browse the repository at this point in the history
  • Loading branch information
francishamel committed Jan 11, 2025
1 parent 11003ec commit 14b6fd2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/home-manager/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
./modules/fonts.nix
./modules/fzf.nix
./modules/git.nix
./modules/glab.nix
./modules/gui.nix
./modules/helix.nix
./modules/jq.nix
Expand Down
5 changes: 4 additions & 1 deletion modules/home-manager/modules/1password/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ let
inherit (lib) mkOption types;

cfg = config.hm._1password;

opCommand = "op plugin run --";
in
{
options = {
Expand Down Expand Up @@ -32,7 +34,8 @@ in
'';

zsh.shellAliases = {
gh = lib.mkIf config.programs.gh.enable "op plugin run -- gh";
gh = lib.mkIf config.programs.gh.enable "${opCommand} gh";
glab = "${opCommand} glab";
};
};
};
Expand Down
41 changes: 41 additions & 0 deletions modules/home-manager/modules/glab.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{ config, pkgs, ... }:

{
home.packages = [ pkgs.glab ];

xdg.configFile."glab-cli/hm_aliases.yml" = {
text = ''
'';
# HACK: necessary since glab-cli requires the permissions of the file to be 600 and
# home-manager creates a symlink with 444 permissions.
onChange = ''
rm -f ${config.xdg.configHome}/glab-cli/aliases.yml
cp ${config.xdg.configHome}/glab-cli/hm_aliases.yml ${config.xdg.configHome}/glab-cli/aliases.yml
chmod 600 ${config.xdg.configHome}/glab-cli/aliases.yml
'';
};

xdg.configFile."glab-cli/hm_config.yml" = {
text = ''
git_protocol: ssh
editor:
browser:
glamour_style: dark
check_update: false
display_hyperlinks: true
host: gitlab.com
no_prompt: false
hosts:
gitlab.com:
api_protocol: https
api_host: gitlab.com
'';
# HACK: necessary since glab-cli requires the permissions of the file to be 600 and
# home-manager creates a symlink with 444 permissions.
onChange = ''
rm -f ${config.xdg.configHome}/glab-cli/config.yml
cp ${config.xdg.configHome}/glab-cli/hm_config.yml ${config.xdg.configHome}/glab-cli/config.yml
chmod 600 ${config.xdg.configHome}/glab-cli/config.yml
'';
};
}

0 comments on commit 14b6fd2

Please sign in to comment.