From f0a04e4d65b77d62a8c9bc6365fc0986c75e45d9 Mon Sep 17 00:00:00 2001 From: Jim Richter Date: Wed, 6 Oct 2021 15:08:18 +0200 Subject: [PATCH] feat: switch from asdf to nix --- configs/.tmux.conf | 18 +++++----------- configs/.zshrc | 27 ------------------------ configs/home.nix | 51 ++++++++++++++++++++++++++++++++++++++++++++++ configs/init.lua | 12 ++++++----- setup.sh | 10 --------- 5 files changed, 63 insertions(+), 55 deletions(-) create mode 100644 configs/home.nix diff --git a/configs/.tmux.conf b/configs/.tmux.conf index 93eb1a3..4388f32 100644 --- a/configs/.tmux.conf +++ b/configs/.tmux.conf @@ -17,30 +17,22 @@ bind -Tcopy-mode WheelUpPane send -N1 -X scroll-up bind -Tcopy-mode WheelDownPane send -N1 -X scroll-down #Use Neovim style navigation -setw -g mode-keys vi +set -g mode-keys vi # Enable mouse mode (tmux 2.1 and above) set -g mouse on # Customize status line -set -g status-position top # statusbar position +# set-option -g status-style bg=default +set-window-option -g status-position top # statusbar position set -g status-interval 1 set -g window-status-format '#[fg=#777777]#(pwd="#{pane_current_path}"; echo ${pwd####*/})' set -g window-status-current-format '#[fg=white, bold]#(pwd="#{pane_current_path}"; echo ${pwd####*/})' set -g status-right-length 120 -set -g status-right '#($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load -m 2 -a 0 -g 0 --interval 1) | #(date +"%H:%M") | #[bold, fg=white]#(whoami)@#(hostname -s) ' -set -g status-bg default -set -g status-fg "#777777" - -# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) -set -g @plugin 'tmux-plugins/tpm' +set -g status-right '#(date +"%H:%M") | #[bold, fg=white]#(whoami)@#(hostname -s) ' +set-option -g status-style bg=default # Add some plugins -set -g @plugin 'tmux-plugins/tmux-sensible' -set -g @plugin 'thewtex/tmux-mem-cpu-load' -set -g @plugin 'tmux-plugins/tmux-yank' set -g @yank_action 'copy-pipe-no-clear' bind -T copy-mode C-c send -X copy-pipe-no-clear "xsel -i --clipboard" bind -T copy-mode-vi C-c send -X copy-pipe-no-clear "xsel -i --clipboard" - -run '~/.tmux/plugins/tpm/tpm' diff --git a/configs/.zshrc b/configs/.zshrc index 3bd36ef..dcf6f3a 100644 --- a/configs/.zshrc +++ b/configs/.zshrc @@ -12,7 +12,6 @@ ZSH_TMUX_AUTOCONNECT=false plugins=( git - asdf docker tmux zsh-autosuggestions @@ -41,26 +40,6 @@ export EDITOR="nvim" # Automatically load direnv if found [[ -s $(which direnv) ]] && eval "$(direnv hook zsh)" -# Load DOTNet if found -if [ -d $HOME/.dotnet ]; then - export DOTNET_ROOT=$HOME/.dotnet; - export PATH=$PATH:$HOME/.dotnet; -fi - -#Load pyenv if found -if [ -s "$HOME/.pyenv" ]; then - export PYENV_ROOT="$HOME/.pyenv" - export PATH="$PYENV_ROOT/bin:$PATH" - eval "$(pyenv init -)" -fi - - -#Load ASDF Version manager if found -if [ -s "$HOME/.asdf" ]; then - . $HOME/.asdf/asdf.sh - . $HOME/.asdf/completions/asdf.bash -fi - # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" @@ -86,11 +65,5 @@ fi # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh -# tabtab source for packages -# uninstall by removing these lines -[[ -f ~/.config/tabtab/zsh/__tabtab.zsh ]] && . ~/.config/tabtab/zsh/__tabtab.zsh || true - export PNPM_HOME="$HOME/.local/share/pnpm" export PATH="$PNPM_HOME:$PATH" - -alias luamake=/home/jim/.local/share/lua-language-server/3rd/luamake/luamake diff --git a/configs/home.nix b/configs/home.nix new file mode 100644 index 0000000..02db62c --- /dev/null +++ b/configs/home.nix @@ -0,0 +1,51 @@ +{ config, pkgs, ... }: + +{ + + programs.direnv.enable = true; + programs.direnv.nix-direnv.enable = true; + programs.direnv.nix-direnv.enableFlakes = true; + programs.zsh.enable = true; + + home.packages = [ + pkgs.neovim + pkgs.zsh + pkgs.direnv + + pkgs.tmux + pkgs.tmuxPlugins.yank + pkgs.tmuxPlugins.cpu + + pkgs.nodejs_latest + + pkgs.nodePackages.pnpm + pkgs.nodePackages.typescript-language-server + pkgs.nodePackages.svelte-language-server + pkgs.nodePackages.diagnostic-languageserver + ]; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + # Home Manager needs a bit of information about you and the + # paths it should manage. + home.username = "jim"; + home.homeDirectory = "/home/jim"; + + xdg.configFile."nvim/init.lua".source = ./init.lua; + home.file.".zshrc".source = ./.zshrc; + home.file.".bashrc".source = ./.bashrc; + home.file.".p10k.zsh".source = ./.p10k.zsh; + home.file.".tmux.conf".source = ./.tmux.conf; + home.file.".dircolors".source = ./.dircolors; + + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + # + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + home.stateVersion = "21.11"; +} diff --git a/configs/init.lua b/configs/init.lua index 4460509..32ac49d 100644 --- a/configs/init.lua +++ b/configs/init.lua @@ -7,7 +7,7 @@ local cmd = vim.cmd require("install-paq") local paq = require("paq") -paq:setup({verbose = true}) { +paq:setup { "savq/paq-nvim", -- Let Paq manage itself -- General Helper Function "nvim-lua/plenary.nvim", @@ -38,7 +38,7 @@ paq:setup({verbose = true}) { "nvim-lua/lsp-status.nvim", "hrsh7th/nvim-cmp", -- Autocompletion plugin "hrsh7th/cmp-nvim-lsp", -- LSP source for nvim-cmp - --"saadparwaiz1/cmp_luasnip", -- Snippets source for nvim-cmp + "saadparwaiz1/cmp_luasnip", -- Snippets source for nvim-cmp "L3MON4D3/LuaSnip", -- Snippets plugin {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}, -- Formatting @@ -76,11 +76,11 @@ if u.has_plugin("cmp") then -- g.NERDTreeCustomOpenArgs = {file = {where = "t"}} g.nvim_tree_gitignore = 1 - g.nvim_tree_auto_open = 1 + --g.nvim_tree_auto_open = 1 g.nvim_tree_group_empty = 1 g.nvim_tree_hide_root_folder = 1 - g.nvim_tree_root_folder_modifier = ":~:." - g.nvim_tree_lsp_diagnostics = 1 + --g.nvim_tree_root_folder_modifier = ":~:." + --g.nvim_tree_lsp_diagnostics = 1 g.nvim_tree_special_files = {} g.nvim_tree_icons = { default = "", @@ -129,6 +129,8 @@ if u.has_plugin("cmp") then g.mapleader = " " require "keymappings" + require'nvim-tree'.setup {} + require "nvim-tmux-navigation".setup { keybindings = { left = "", diff --git a/setup.sh b/setup.sh index 0b555cf..25d56a5 100755 --- a/setup.sh +++ b/setup.sh @@ -12,7 +12,6 @@ fi . ./helpers/prompt.sh --source-only . ./helpers/linker.sh --source-only . ./helpers/multiselect.sh --source-only -. ./helpers/asdf-install.sh --source-only echo "-- welcome to my setup script --" @@ -106,15 +105,6 @@ if [ "$INST_ASDF" = true ]; then [[ "$INST_RUST" = true ]] && asdfInstall rust fi -echo "-- linking .dotfiles --" - -linkFile .bashrc -linkFile .p10k.zsh -linkFile .dircolors -linkFile .tmux.conf - -echo "-----------------------------------" - if [ "$INST_ZSH" = true ]; then echo "-- installing oh-my-zsh --" linkFile .zshrc