Skip to content

Commit

Permalink
Misc (#354)
Browse files Browse the repository at this point in the history
* Move custom home-manager module options to hm.<package>

* Move setopt completealiases to base zsh config

* Use proper way to set session variable for SSH_AUTH_SOCK

* Only enable gh op plugin if gh is enabled

* Fix delta theme

* Ensure we use the proper package for lazygit alias

* Move configs to their own directory

These are for more complicated configs that use configs in different
languages.

* Remove fzf_with_hx function

I want to use proper zle widgets instead. Will get there someday.

* Add TODO

* Wezterm front_end bug seems to be fixed

* No issue with individual flakes

* Configure ripgrep with good defaults

* nix flake update
  • Loading branch information
francishamel authored Jan 9, 2025
1 parent 1e95816 commit ffaf061
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 54 deletions.
44 changes: 22 additions & 22 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ darwin-rebuild:
@darwin-rebuild switch --flake .#

update:
@nix flake update nixpkgs nix-darwin home-manager treefmt-nix flake-parts
@nix flake update

format:
@nix fmt
4 changes: 2 additions & 2 deletions modules/home-manager/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
./modules/starship.nix
./modules/terminal.nix
./modules/vscode.nix
./modules/wezterm.nix
./modules/wezterm
./modules/yazi.nix
./modules/zellij.nix
./modules/zellij
./modules/zoxide.nix
];
home.stateVersion = "22.11";
Expand Down
19 changes: 7 additions & 12 deletions modules/home-manager/modules/1password/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
let
inherit (lib) mkOption types;

cfg = config._1password;
cfg = config.hm._1password;
in
{
options = {
_1password.sockPath = mkOption {
hm._1password.sockPath = mkOption {
type = types.str;
};
_1password.sshProgram = mkOption {
hm._1password.sshProgram = mkOption {
type = types.str;
};
};

config = {
home.sessionVariables.SSH_AUTH_SOCK = "${cfg.sockPath}";

programs = {
git.extraConfig = {
commit.gpgsign = true;
Expand All @@ -29,15 +31,8 @@ in
IdentityAgent "${cfg.sockPath}"
'';

zsh = {
initExtra = ''
SSH_AUTH_SOCK="${cfg.sockPath}"
# This is needed for autocompletion to work with op plugin
setopt completealiases
'';
shellAliases = {
gh = "op plugin run -- gh";
};
zsh.shellAliases = {
gh = lib.mkIf config.programs.gh.enable "op plugin run -- gh";
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion modules/home-manager/modules/1password/darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
imports = [ ./common.nix ];

_1password = {
hm._1password = {
sockPath = "${config.home.homeDirectory}/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock";
sshProgram = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign";
};
Expand Down
2 changes: 1 addition & 1 deletion modules/home-manager/modules/1password/linux.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
imports = [ ./common.nix ];

_1password = {
hm._1password = {
sockPath = "${config.home.homeDirectory}/.1password/agent.sock";
sshProgram = "/run/current-system/sw/bin/op-ssh-sign";
};
Expand Down
1 change: 1 addition & 0 deletions modules/home-manager/modules/alacritty.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
enable = false;
settings = {
# Nord theme taken from: https://github.com/alacritty/alacritty-theme/blob/95a7d695605863ede5b7430eb80d9e80f5f504bc/themes/nord.toml
# TODO: use fetchUrl
colors = {
primary = {
background = "#2E3440";
Expand Down
12 changes: 4 additions & 8 deletions modules/home-manager/modules/fzf.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
{ config, pkgs, lib, ... }:
{ config, pkgs, ... }:
let
fd = "${config.programs.fd.package}/bin/fd";
fileCommand = "${fd} --type=file";
openWithHx = ''
fzf_with_hx() {
${config.programs.fzf.package}/bin/fzf --multi --bind 'enter:become(${config.programs.helix.package}/bin/hx {+})'
}
bindkey -s '^o' 'fzf_with_hx\n'
'';
in
{
home.packages = [ pkgs.zsh-fzf-tab ];
Expand Down Expand Up @@ -44,7 +38,9 @@ in
};
zsh.initExtra = ''
source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh
# fzf-tab does not take default options into consideration so we have to set the height directly
zstyle ':fzf-tab:*' fzf-flags --height=40%
'' + lib.optionalString (config.programs.helix.enable) openWithHx;
'';
};
}
14 changes: 12 additions & 2 deletions modules/home-manager/modules/git.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
line-numbers = true;
navigate = true;
side-by-side = true;
theme = "Nord";
};
};
};
Expand Down Expand Up @@ -70,6 +69,17 @@
};
};

zsh.shellAliases.lg = "${pkgs.lazygit}/bin/lazygit";
zsh.shellAliases.lg = "${config.programs.lazygit.package}/bin/lazygit";
};


# delta themes config
xdg.configFile."git/delta/themes.gitconfig" = {
source = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/dandavison/delta/ef3e1be569bf076f035327342939bd9d7c8908bd/themes.gitconfig";
sha256 = "sha256-NBALeGfKhgDbCqzBVirC0886P0CCVvAH3Pf3NvVg4KM=";
};
};
programs.git.extraConfig.include.path = "delta/themes.gitconfig";
programs.git.delta.options.features = "arctic-fox";
}
9 changes: 8 additions & 1 deletion modules/home-manager/modules/ripgrep.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
{
home.packages = [ pkgs.repgrep ];

programs.ripgrep.enable = true;
programs.ripgrep = {
enable = true;
arguments = [
"--smart-case"
"--hidden"
"--glob=!.git/*"
];
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
programs.wezterm = {
enable = true;
enableZshIntegration = true;
extraConfig = builtins.readFile ./wezterm/wezterm.lua;
extraConfig = builtins.readFile ./wezterm.lua;
};
}
2 changes: 0 additions & 2 deletions modules/home-manager/modules/wezterm/wezterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ config.color_scheme = "nord"
config.font = wezterm.font("FiraCode Nerd Font")
config.font_size = 14.0

config.front_end = "WebGpu"

config.window_close_confirmation = "NeverPrompt"
config.window_decorations = "RESIZE"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@

xdg.configFile."zellij/layouts" = {
recursive = true;
source = ./zellij/layouts;
source = ./layouts;
};
}
3 changes: 3 additions & 0 deletions modules/home-manager/modules/zsh/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
enable = true;
historySubstringSearch.enable = true;
initExtra = ''
# This is needed for autocompletion to work with aliases
setopt completealiases
bindkey '^U' backward-kill-line
'';
};
Expand Down

0 comments on commit ffaf061

Please sign in to comment.