feat: nvim new configs

This commit is contained in:
Rasyidan Akbar F. 2025-10-28 20:32:32 +07:00
commit 553ef00fa9
17 changed files with 447 additions and 96 deletions

View file

@ -35,15 +35,65 @@ let
echo "Restart Claude Code and Codex to apply changes."
'';
# Helper that builds the wrapped Neovim from the flake and runs it with repo-scoped XDG dirs
previewNvim = pkgs.writeShellScriptBin "preview-nvim" ''
set -euo pipefail
root="''${DOTFILES_ROOT:-$PWD}"
cache_base="$root/.cache"
nvim_cache="$cache_base/nvim-preview"
xdg_state="$cache_base/xdg-state"
xdg_data="$cache_base/xdg-data"
xdg_config="$root/modules/home/rsydn/programs"
mkdir -p "$nvim_cache" "$xdg_state" "$xdg_data"
attr="''${NVIM_ATTR:-}"
if [ "$#" -gt 0 ]; then
attr="$1"
shift
fi
if [ -z "$attr" ]; then
case "$(uname -s)" in
Darwin)
attr=".#darwinConfigurations.macbook-pro.config.home-manager.users.rasyidanakbar.programs.neovim.finalPackage"
;;
Linux)
attr=".#nixosConfigurations.dev-vm.config.home-manager.users.rasyidanakbar.programs.neovim.finalPackage"
;;
*)
echo "error: unsupported system; pass flake attribute as first argument or set NVIM_ATTR" >&2
exit 1
;;
esac
fi
out_link="$nvim_cache/result"
echo "Building Neovim package: $attr"
XDG_CACHE_HOME="$nvim_cache" nix build "$attr" --out-link "$out_link"
echo "Launching Neovim..."
XDG_CACHE_HOME="$nvim_cache" \
XDG_STATE_HOME="$xdg_state" \
XDG_DATA_HOME="$xdg_data" \
XDG_CONFIG_HOME="$xdg_config" \
NVIM_APPNAME="nvim" \
"$out_link/bin/nvim" "$@"
'';
in pkgs.mkShell {
name = "default";
packages = with pkgs; [
git
nix
nixfmt-classic
uv
python3
mcpNixosWrapper
installMcpConfigs
previewNvim
];
shellHook = ''
export DOTFILES_ROOT="$PWD"
@ -63,5 +113,8 @@ in pkgs.mkShell {
echo ""
echo "To install MCP configs for Claude Code and Codex, run:"
echo " install-mcp-configs"
echo ""
echo "To preview the Neovim config without switching, run:"
echo " preview-nvim [flakeAttr] [-- extra args]"
'';
}