diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index c8aef44..54a87cc 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -499,12 +499,21 @@ require('telescope').setup { -- Telescope key remap stuffs pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'file_browser') +pcall(require('telescope').load_extension, 'git_worktree') remap('n', '', 'Telescope', { desc = 'Open Telescope general search' }) remap('n', 'fm', function() require("telescope").extensions.file_browser.file_browser({}) end, { desc = '[F]ile [M]utation' }) +remap('n', 'ft', function() + require("telescope").extensions.git_worktree.git_worktrees() +end, { desc = '[F]ind [T]ree' }) + +remap('n', 'tm', function() + require("telescope").extensions.git_worktree.create_git_worktree() +end, { desc = '[T]ree [M]utate' }) + remap('n', 'ff', function() require('telescope.builtin').find_files({ hidden = false, diff --git a/nix/repo/home-configs/default.nix b/nix/repo/home-configs/default.nix index bf085bb..e8e1f5b 100644 --- a/nix/repo/home-configs/default.nix +++ b/nix/repo/home-configs/default.nix @@ -20,13 +20,15 @@ }; base-modules = [ - home-profiles.alacritty + # home-profiles.alacritty + home-modules.alacritty + home-profiles.kitty home-profiles.git home-profiles.ssh home-profiles.shells {config.programs.home-manager.enable = true;} - home-profiles.nix-index + # home-profiles.nix-index home-profiles.neovim ]; in { @@ -42,15 +44,14 @@ in { home-profiles.nerd_font_module home-profiles.git-htran home-profiles.dev-packages - home-profiles.zk + # home-profiles.zk home-modules.darwin-spotlight - { home.username = "htran"; home.homeDirectory = "/Users/htran"; home.stateVersion = "23.11"; } - home-profiles.passman + # home-profiles.passman ]; }; }; @@ -67,47 +68,13 @@ in { home-profiles.nerd_font_module home-profiles.git-pegasust home-profiles.dev-packages - home-profiles.zk + # home-profiles.zk home-modules.darwin-spotlight { home.username = "hungtran"; home.homeDirectory = "/Users/hungtran"; home.stateVersion = "23.11"; - repo.shells.shellAliases = { - git-lol = '' - git log --graph --decorate --color=always --abbrev-commit \ - --pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' | - while IFS= read -r line; do - # Format the relative time - line=$(echo "$line" | sed -e 's/ minute/ min/' \ - -e 's/ week/ wk/' \ - -e 's/ hour/ hr/' \ - -e 's/ month/ mo/' \ - -e 's/ year/ yr/' \ - -e 's/ ago//') - - # Print the formatted line - echo "$line" - done | less -R - ''; - git-lola = '' - git log --graph --decorate --color=always --abbrev-commit --all\ - --pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' | - while IFS= read -r line; do - # Format the relative time - line=$(echo "$line" | sed -e 's/ minute/ min/' \ - -e 's/ week/ wk/' \ - -e 's/ hour/ hr/' \ - -e 's/ month/ mo/' \ - -e 's/ year/ yr/' \ - -e 's/ ago//') - - # Print the formatted line - echo "$line" - done | less -R - ''; - }; } ]; }; diff --git a/nix/repo/home-profiles/default.nix b/nix/repo/home-profiles/default.nix index 17812eb..3da955b 100644 --- a/nix/repo/home-profiles/default.nix +++ b/nix/repo/home-profiles/default.nix @@ -210,10 +210,12 @@ in { ]; }; - passman = { + passman = {pkgs}: { # Bruh, keepassxc on Darwin doesn't contain cli # On Linux, however, it correctly gives `keepassxc-cli` - home.packages = [cell.packages.kpxc]; + home.packages = assert !pkgs.stdenv.isDarwin || throw "kpxc known to have caused sandbox-exec problem"; [ + cell.packages.kpxc + ]; }; darwin-patches = { @@ -221,4 +223,17 @@ in { # a community-driven project. Things fail to build all the time. manual.manpages.enable = false; }; + + # inspo: https://github.com/NixOS/nixpkgs/blob/0396d3b0fb7f62ddc79a506ad3e6124f01d2ed0a/nixos/modules/rename.nix + rename = { + config, + options, + pkgs, + }: { + imports = let + inherit (pkgs.lib) mkRemovedOptionModule; + in [ + (mkRemovedOptionModule ["programs" "nix-index" "enable"] "nix-index seems to not really benefit us") + ]; + }; } diff --git a/nix/repo/home-profiles/shells.nix b/nix/repo/home-profiles/shells.nix index e199941..0e6c27e 100644 --- a/nix/repo/home-profiles/shells.nix +++ b/nix/repo/home-profiles/shells.nix @@ -88,6 +88,42 @@ in { enable = true; enableCompletion = true; initExtra = cfg.shellInitExtra or ""; + shellAliases = + { + git-lol = '' + git log --graph --decorate --color=always --abbrev-commit \ + --pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' | + while IFS= read -r line; do + # Format the relative time + line=$(echo "$line" | sed -e 's/ minute/ min/' \ + -e 's/ week/ wk/' \ + -e 's/ hour/ hr/' \ + -e 's/ month/ mo/' \ + -e 's/ year/ yr/' \ + -e 's/ ago//') + + # Print the formatted line + echo "$line" + done | less -R + ''; + git-lola = '' + git log --graph --decorate --color=always --abbrev-commit --all\ + --pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' | + while IFS= read -r line; do + # Format the relative time + line=$(echo "$line" | sed -e 's/ minute/ min/' \ + -e 's/ week/ wk/' \ + -e 's/ hour/ hr/' \ + -e 's/ month/ mo/' \ + -e 's/ year/ yr/' \ + -e 's/ ago//') + + # Print the formatted line + echo "$line" + done | less -R + ''; + } + // (cfg.shellAliases or {}); }; programs.zsh = { enable = true; @@ -97,6 +133,38 @@ in { { nix-rebuild = "sudo nixos-rebuild switch"; hm-switch = "home-manager switch --flake"; + git-lol = '' + git log --graph --decorate --color=always --abbrev-commit \ + --pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' | + while IFS= read -r line; do + # Format the relative time + line=$(echo "$line" | sed -e 's/ minute/ min/' \ + -e 's/ week/ wk/' \ + -e 's/ hour/ hr/' \ + -e 's/ month/ mo/' \ + -e 's/ year/ yr/' \ + -e 's/ ago//') + + # Print the formatted line + echo "$line" + done | less -R + ''; + git-lola = '' + git log --graph --decorate --color=always --abbrev-commit --all\ + --pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' | + while IFS= read -r line; do + # Format the relative time + line=$(echo "$line" | sed -e 's/ minute/ min/' \ + -e 's/ week/ wk/' \ + -e 's/ hour/ hr/' \ + -e 's/ month/ mo/' \ + -e 's/ year/ yr/' \ + -e 's/ ago//') + + # Print the formatted line + echo "$line" + done | less -R + ''; } // (cfg.shellAliases or {}); history = { diff --git a/nix/repo/packages/default.nix b/nix/repo/packages/default.nix index 1f4cf8f..e679714 100644 --- a/nix/repo/packages/default.nix +++ b/nix/repo/packages/default.nix @@ -8,32 +8,35 @@ in { kpxc = let inherit (pkgs) keepassxc; in - pkgs.stdenv.mkDerivation { - pname = "keepassxc-darwin"; - version = keepassxc.version; + if pkgs.stdenv.isDarwin + then + pkgs.stdenv.mkDerivation { + pname = "keepassxc-darwin"; + version = keepassxc.version; - phases = ["installPhase"]; - installPhase = '' - mkdir -p $out/bin - cp -r ${keepassxc}/* $out/ + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + cp -r ${keepassxc}/* $out/ - ${ - if pkgs.stdenv.hostPlatform.isDarwin - then '' - for exe in $(find $out/Applications/KeePassXC.app/Contents/MacOS/ -type f -executable); do - exe_name=$(basename $exe) - ln -s $exe $out/bin/$exe_name - done - '' - else "" - } - ''; - meta = - keepassxc.meta - // { - description = "Wrapper for keepassxc and keepassxc-cli with additional Darwin-specific fixes"; - }; - }; + ${ + if pkgs.stdenv.hostPlatform.isDarwin + then '' + for exe in $(find $out/Applications/KeePassXC.app/Contents/MacOS/ -type f -executable); do + exe_name=$(basename $exe) + ln -s $exe $out/bin/$exe_name + done + '' + else "" + } + ''; + meta = + keepassxc.meta + // { + description = "Wrapper for keepassxc and keepassxc-cli with additional Darwin-specific fixes"; + }; + } + else keepassxc; pixi-edit = inputs.cells.dev.packages.pixi-edit;