From 4666ba04c562bcd2e49cf9333ab1be88af87a55c Mon Sep 17 00:00:00 2001 From: Djai Hougee Date: Sun, 27 Sep 2026 23:02:17 +0200 Subject: [PATCH] moved dev/terminal to own folders --- modules/dev/default.nix | 75 ++++++++++++++++++++++++++++++ modules/dev/nvim.conf | 23 ++++++++++ modules/dev/nvim.plugins | 36 +++++++++++++++ modules/terminal/default.nix | 36 +++++++++++++++ modules/terminal/tmux.conf | 89 ++++++++++++++++++++++++++++++++++++ 5 files changed, 259 insertions(+) create mode 100644 modules/dev/default.nix create mode 100644 modules/dev/nvim.conf create mode 100644 modules/dev/nvim.plugins create mode 100644 modules/terminal/default.nix create mode 100644 modules/terminal/tmux.conf diff --git a/modules/dev/default.nix b/modules/dev/default.nix new file mode 100644 index 0000000..328472e --- /dev/null +++ b/modules/dev/default.nix @@ -0,0 +1,75 @@ +{ pkgs, inputs, ... }: + +let + system = pkgs.stdenv.hostPlatform.system; + nvchad = inputs.nix4nvchad.packages.${system}.default.override { + extraConfig = builtins.readFile ./nvim.conf; + extraPlugins = builtins.readFile ./nvim.plugins; + }; +in +{ + programs.java.enable = true; + programs.nix-ld.libraries = with pkgs; [ + stdenv.cc.cc.lib + zlib + ncurses5 + libGL + libGLU + vulkan-loader + libdrm + mesa + libx11 + libxcursor + libxrandr + libxi + libxext + libxfixes + libxcb + wayland + libpulseaudio + alsa-lib + nss + nspr + expat + glib + dbus + systemd + freetype + fontconfig + ]; + + users.users.djai.packages = with pkgs; [ + # dev environment + godot + nvchad + jq + lazygit + ripgrep + + # toolchains + cargo + gcc + gnumake + openssl + python3 + rustc + uv + + # containers / secrets + age + fluxcd + k9s + kubectl + kubectx + sops + + # hosts / networks + wireguard-tools + lm_sensors + + ]; + + # TODO: switch to home manager + # home-manager.users.djai.home.packages = with pkgs; []; + +} diff --git a/modules/dev/nvim.conf b/modules/dev/nvim.conf new file mode 100644 index 0000000..e9ea454 --- /dev/null +++ b/modules/dev/nvim.conf @@ -0,0 +1,23 @@ +local map = vim.keymap.set +local builtin = require('telescope.builtin') + +map("n", ";", ":", { desc = "CMD enter command mode" }) +map("n", "sw", " set wrap! ", {desc = "Toggle text wrapping"}) +map("n", "fm", function() require("conform").format() end, {desc = "Format with conform"}) +map("n", "-", " Oil ", {desc = "Open directory in oil"}) +map("n", "rcu", function() require('crates').upgrade_all_crates() end, {desc = "Upgrade rust crates"}) +map("n", "ca", function() vim.lsp.buf.code_action() end, {desc = "Lsp code action"}) +map("n", "gr", function() vim.lsp.buf.references() end, {desc = "Lsp references"}) +map("n", "gm", "Telescope git_commits", { desc = "telescope git commits" }) + +map('n', 'fi', function() + builtin.live_grep({ + prompt_title = "Files matching TODO", + default_text = "(TODO|todo|FIXME|THOUGHT|REFACTOR|TEST)", + }) +end, {desc = "find comments using telescope"}) + +-- stay in v mode after indenting +map("v", "<", "", ">gv") + diff --git a/modules/dev/nvim.plugins b/modules/dev/nvim.plugins new file mode 100644 index 0000000..2a9c854 --- /dev/null +++ b/modules/dev/nvim.plugins @@ -0,0 +1,36 @@ +return { + { + "neovim/nvim-lspconfig", + config = function() + require "configs.lspconfig" + end, + },{ + "rcarriga/nvim-notify", + event = "VeryLazy", + config = function() + local notify = require "notify" + notify.setup { + background_colour = "#2D3540", + } + vim.notify = notify + end, + },{ + "stevearc/oil.nvim", + opts = {}, + dependencies = { "nvim-tree/nvim-web-devicons"}, + lazy = false + },{ + 'saecki/crates.nvim', + event = { "BufRead Cargo.toml" }, + config = function() + require('crates').setup() + end, + },{ + "jglasovic/venv-lsp.nvim", + config = function() + require("venv-lsp").setup() + end, + lazy = false, + } +} + diff --git a/modules/terminal/default.nix b/modules/terminal/default.nix new file mode 100644 index 0000000..93e4c00 --- /dev/null +++ b/modules/terminal/default.nix @@ -0,0 +1,36 @@ +{ pkgs, ... }: + +{ + environment.defaultPackages = with pkgs; [ + fbterm + kitty + starship + ]; + + # TODO: switch to home manager + programs.fish.enable = true; + programs.tmux = { + enable = true; + extraConfig = builtins.readFile ./tmux.conf; + + plugins = with pkgs.tmuxPlugins; [ + sensible + resurrect + ]; + }; + + # home-manager.users.djai = { + # programs.fish.enable = true; + # programs.tmux.enable = true; + # + # programs.kitty = { + # enable = true; + # settings = { + # shell = "${pkgs.tmux}/bin/tmux"; + # font_family = "Iosevka Nerd Font"; + # }; + # extraConfig = ""; # TODO theming + # }; + # + # }; +} diff --git a/modules/terminal/tmux.conf b/modules/terminal/tmux.conf new file mode 100644 index 0000000..df8d1bc --- /dev/null +++ b/modules/terminal/tmux.conf @@ -0,0 +1,89 @@ +# use as leader +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +bind ? list-keys + +# window/pane management +bind s split-window -h -c "#{pane_current_path}" +bind C-s select-layout main-horizontal \; swap-pane -t 0 \; select-pane -t 0 +bind S select-layout even-horizontal +bind v split-window -v -c "#{pane_current_path}" +bind C-v select-layout main-vertical \; swap-pane -t 0 \; select-pane -t 0 +bind V select-layout even-vertical +bind c new-window -c "#{pane_current_path}" +# move pane to new tab +bind b break-pane +# swap active pane and first pane +bind a swap-pane -t 0 \; select-pane -t 0 +unbind '"' +unbind % + +# vim-style pane switching with through +bind -n M-h select-pane -L +bind -n M-j select-pane -D +bind -n M-k select-pane -U +bind -n M-l select-pane -R +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R +# Resize using caps +bind -r H resize-pane -L 5 +bind -r J resize-pane -D 5 +bind -r K resize-pane -U 5 +bind -r L resize-pane -R 5 + +# vim-style copy mode +set-window-option -g mode-keys vi +bind-key -T copy-mode-vi 'v' send-keys -X begin-selection +bind-key -T copy-mode-vi 'y' send-keys -X copy-selection-and-cancel +bind-key p paste-buffer + +# window traversal +bind -n M-n next-window +bind tab next-window + + +# reload config with r +bind r source-file ~/.config/tmux/tmux.conf +# dont rename windows automatically +# set-option -g allow-rename off + + +# ----- UI/UX ----- + +# don't do anything when a 'bell' rings +set -g visual-activity off +set -g visual-bell off +set -g visual-silence off +setw -g monitor-activity off +set -g bell-action none + +# copy mode +setw -g mode-style 'fg=black bg=red bold' + +# panes +set -g pane-border-style 'fg=black' +set -g pane-active-border-style 'fg=white' + +# status +set -g status-position bottom +set -g status-justify left +set -g status-style 'bg=black fg=white' + +set -g status-left "" +set -g status-right "" + +# window status +setw -g window-status-current-style 'bg=blue fg=black' +setw -g window-status-current-format '◤ #W ◢' + +setw -g window-status-style 'fg=white bg=black' +setw -g window-status-format '#[fg=black]◤ #[fg=white]#W #[fg=black]◢' +setw -g window-status-bell-style 'fg=yellow bg=red bold' + +# messages +set -g message-style 'fg=black bg=blue' +