From 3b0e02369624ae36042b6a488744cf1194d24a92 Mon Sep 17 00:00:00 2001 From: Stefan Imhoff Date: Fri, 28 Jun 2024 20:05:55 +0200 Subject: [PATCH] feat(nix): migrate ripgrep settings --- .dotbot.conf.yaml | 1 - fish/config.fish | 6 +++++- nix/README.md | 8 +++++++- nix/home/default.nix | 6 +----- nix/home/ripgrep/default.nix | 11 +++++++++++ search/ripgrep => nix/home/ripgrep/ripgreprc | 4 ++-- zsh/zshrc | 2 +- 7 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 nix/home/ripgrep/default.nix rename search/ripgrep => nix/home/ripgrep/ripgreprc (81%) diff --git a/.dotbot.conf.yaml b/.dotbot.conf.yaml index 9a7523a..2afb553 100644 --- a/.dotbot.conf.yaml +++ b/.dotbot.conf.yaml @@ -56,7 +56,6 @@ ~/.gnupg/gpg.conf: gpg/gpg.conf ~/.hammerspoon: hammerspoon ~/.pandoc: pandoc - ~/.ripgreprc: search/ripgrep ~/.tmux-cht-command: tmux/tmux-cht-command ~/.tmux-cht-languages: tmux/tmux-cht-languages ~/.tmux.conf: tmux/tmux.conf diff --git a/fish/config.fish b/fish/config.fish index 818baaf..397fea8 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -48,7 +48,7 @@ end set --export XDG_CONFIG_HOME "$HOME/.config" set --export KEYTIMEOUT 1 -set --export RIPGREP_CONFIG_PATH $HOME/.ripgreprc +set --export RIPGREP_CONFIG_PATH $HOME/.config/ripgrep/ripgreprc set --export GIT_EDITOR nvim set --export EDITOR nvim @@ -96,6 +96,7 @@ if test -f $nix_path end set --export PATH /run/current-system/sw/bin $PATH +set --export PATH /etc/profiles/per-user/$USER/bin $PATH # Zoxide zoxide init fish | source @@ -211,6 +212,9 @@ alias mux tmuxinator alias ms 'mux start' alias ta 'tmux attach' +# Nix +alias nxs 'darwin-rebuild switch --flake ~/.dotfiles/nix' + # Bat alias cat bat diff --git a/nix/README.md b/nix/README.md index 5dc8d9e..7016520 100644 --- a/nix/README.md +++ b/nix/README.md @@ -7,7 +7,13 @@ This is my folder where I migrate my current dotfile setup to [Nix](https://nixo ```sh # First time install -nix run nix-darwin -- switch --flake ~/.config/nix-darwin +nix run nix-darwin -- switch --flake ~/.dotfiles/nix +``` + +By default the `$hostname` that matches the current machine is used, but it is possible to manually load one by running: + +```sh +nix run nix-darwin -- switch --flake ~/.dotfiles/nix#mac-mini ``` Make sure this is added to your path: diff --git a/nix/home/default.nix b/nix/home/default.nix index b8afb8f..d0e570e 100644 --- a/nix/home/default.nix +++ b/nix/home/default.nix @@ -6,6 +6,7 @@ in { # https://nix-community.github.io/home-manager/options.html imports = [ + ./ripgrep ./skhd ./yabai ]; @@ -23,11 +24,6 @@ in # environment. home.packages = with pkgs; [ nixpkgs-fmt - ripgrep ]; - - home.sessionVariables = { - EDITOR = "vim"; - }; }; } diff --git a/nix/home/ripgrep/default.nix b/nix/home/ripgrep/default.nix new file mode 100644 index 0000000..4174901 --- /dev/null +++ b/nix/home/ripgrep/default.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + home.file.".config/ripgrep/ripgreprc" = { + source = ./ripgreprc; + }; + + programs.ripgrep = { + enable = true; + }; +} diff --git a/search/ripgrep b/nix/home/ripgrep/ripgreprc similarity index 81% rename from search/ripgrep rename to nix/home/ripgrep/ripgreprc index c62a31b..9b4a8a0 100644 --- a/search/ripgrep +++ b/nix/home/ripgrep/ripgreprc @@ -1,9 +1,9 @@ --max-columns-preview ---type-add +--type-add web:*.{html,css,js,jsx,ts,tsx}* ---type-add +--type-add text:*.{md,mdx,txt}* --glob=!git/* diff --git a/zsh/zshrc b/zsh/zshrc index f4fbdc5..c0b5e40 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -14,7 +14,7 @@ export SSH_AUTH_SOCK=$HOME/Library/Containers/com.maxgoedjen.Secretive.SecretAge export XDG_CONFIG_HOME="$HOME/.config" export KEYTIMEOUT=1 -export RIPGREP_CONFIG_PATH=$HOME/.ripgreprc +export RIPGREP_CONFIG_PATH=$HOME/.config/ripgrep/ripgreprc export GIT_EDITOR=nvim export EDITOR=nvim