From 1929563b9a0ffde01ed203951ec299b57cc12cbc Mon Sep 17 00:00:00 2001 From: 4o1x5 <4o1x5@4o1x5.dev> Date: Thu, 29 Aug 2024 18:25:03 +0200 Subject: [PATCH] nixvim: some neovim configs --- nix/apps/graphics.nix | 1 + nix/configs/firewall.nix | 5 +- nix/configs/i3.nix | 19 +- nix/configs/logseq.nix | 1 + .../{prometheus.nix => node_exporter.nix} | 4 +- nix/configs/nvim.nix | 190 +++++++++++++++--- nix/configs/picom.nix | 65 +----- nix/configs/polybar/top.nix | 22 +- nix/configuration.nix | 2 +- nix/desktop.nix | 24 +-- nix/gaming.nix | 4 +- nix/system/cursor.nix | 8 - nix/system/remap.nix | 1 + nix/system/shell.nix | 1 + 14 files changed, 196 insertions(+), 151 deletions(-) rename nix/configs/{prometheus.nix => node_exporter.nix} (66%) delete mode 100755 nix/system/cursor.nix diff --git a/nix/apps/graphics.nix b/nix/apps/graphics.nix index b76245e..ad9c992 100644 --- a/nix/apps/graphics.nix +++ b/nix/apps/graphics.nix @@ -3,5 +3,6 @@ environment.systemPackages = with pkgs; [ #krita gimp + figma-linux ]; } diff --git a/nix/configs/firewall.nix b/nix/configs/firewall.nix index 15da07b..97d0941 100644 --- a/nix/configs/firewall.nix +++ b/nix/configs/firewall.nix @@ -1,8 +1,11 @@ { pkgs, ... }: { networking.firewall = { - #extraCommands = "iptables -I FORWARD default"; + enable = true; allowedUDPPorts = [ 34197 #factorio ]; + allowedTCPPorts = [ + 25565 # mc + ]; }; } diff --git a/nix/configs/i3.nix b/nix/configs/i3.nix index 18866db..dbd2a87 100755 --- a/nix/configs/i3.nix +++ b/nix/configs/i3.nix @@ -3,8 +3,6 @@ let scripts = "~/.config/scripts"; in { - - home-manager.users.grape.xsession.windowManager.i3 = { enable = true; config = { @@ -18,7 +16,7 @@ in command = "nitrogen --set-zoom-fill /home/grape/dotfiles/bg.jpg"; } { - command = "picom -b --experimental-backends"; + command = "picom -b"; } { command = "polybar default"; @@ -49,6 +47,7 @@ in }; + keybindings = lib.mkOptionDefault { @@ -62,6 +61,7 @@ in "mod4+r" = "exec firefox"; "mod4+m" = "exec feishin"; "mod4+p" = "exec keepassxc"; + "mod4+g" = "exec alacritty --command btop"; # power off @@ -77,21 +77,11 @@ in "mod4+a" = "exec ${scripts}/start_replay.sh"; "mod4+x" = "exec ${scripts}/stop_replay.sh"; - # timewarrior - "mod4+h" = "exec ${scripts}/timew_start.sh"; - "mod4+j" = "exec timew stop"; - "mod4+k" = "exec timew cancel"; - "mod4+g" = "exec timew continue"; - # picom - "mod4+o" = "exec ${scripts}/picom_opacity_toggle.sh"; # toggle opacity (some games have it by default due to incorrect configuration i cannot find ) - + "mod4+o" = "exec ${scripts}/picom_opacity_toggle.sh"; # screenshot - # shit needs work "Print" = "exec scrot '%Y-%m-%d_%H-%M-%S.png' -e 'mv $f ~/Pictures/screenshots && xclip -selection clipboard -t image/png -i ~/Pictures/screenshots/$f'"; - "mod4+Print" = "exec scrot '%Y-%m-%d_%H-%M-%S.png' -e -u 'mv $f ~/Pictures/screenshots && xclip -selection clipboard -t image/png -i ~/Pictures/screenshots/$f'"; - # select window to screenshot then saves it to /home/pictures/screenshots/date+random.png and copies to clipboard "Shift+Print" = ''exec "NUM=$(echo $RANDOM) maim -s $HOME/Pictures/screenshots/$(date +%Y%m%d_%H%M)$NUM.png ; cat $HOME/Pictures/screenshots/$(date +%Y%m%d_%H%M)$NUM.png | xclip -selection clipboard -t image/png"''; # sticky window @@ -101,7 +91,6 @@ in # Volume adjustment for current player "shift+XF86AudioRaiseVolume" = "exec --no-startup-id playerctl volume 0.1+"; "shift+XF86AudioLowerVolume" = "exec --no-startup-id playerctl volume 0.1-"; - # seeking for current player "Control+XF86AudioRaiseVolume" = "exec --no-startup-id playerctl position 10+"; "Control+XF86AudioLowerVolume" = "exec --no-startup-id playerctl position 10-"; diff --git a/nix/configs/logseq.nix b/nix/configs/logseq.nix index ca1f16a..7437bcc 100644 --- a/nix/configs/logseq.nix +++ b/nix/configs/logseq.nix @@ -14,6 +14,7 @@ :logseq-banners-plugin {:version "v3.4.11", :repo "yoyurec/logseq-banners-plugin", :effect true, :theme false} :logseq-plugin-automatic-url-title {:version "v1.1.0", :repo "0x7b1/logseq-plugin-automatic-url-title", :effect true, :theme false} :logseq-bionic-speedreader {:version "1.0.1", :repo "sawhney17/logseq-bionic-speedreader", :effect true, :theme false} + :logseq-drawio-plugin {:version "v1.7.0", :repo "lee88688/logseq-drawio-plugin", :effect true, :theme false} } ''; }; diff --git a/nix/configs/prometheus.nix b/nix/configs/node_exporter.nix similarity index 66% rename from nix/configs/prometheus.nix rename to nix/configs/node_exporter.nix index cd036c3..967f8a5 100644 --- a/nix/configs/prometheus.nix +++ b/nix/configs/node_exporter.nix @@ -1,8 +1,8 @@ { pkgs, ... }: { services.prometheus.exporters.node = { - enable = false; + enable = true; port = 9001; openFirewall = true; - listenAddress = "32.54.31.0"; + listenAddress = "0.0.0.0"; }; } diff --git a/nix/configs/nvim.nix b/nix/configs/nvim.nix index 5eeaae2..403b0af 100644 --- a/nix/configs/nvim.nix +++ b/nix/configs/nvim.nix @@ -3,13 +3,6 @@ enable = true; #TODO floaterm - # test tool - plugins.neotest = { - enable = true; - }; - - # TODO nvim-lspconfig - # a snippet engine plugins.luasnip = { enable = true; @@ -20,6 +13,161 @@ # enable = true; #}; + plugins.none-ls = { + enable = true; + sources = { + code_actions = { + statix.enable = true; + gitsigns.enable = true; + }; + diagnostics = { + statix.enable = true; + deadnix.enable = true; + pylint.enable = true; + checkstyle.enable = true; + }; + formatting = { + alejandra.enable = true; + stylua.enable = true; + shfmt.enable = true; + nixpkgs_fmt.enable = true; + google_java_format.enable = false; + prettier = { + enable = true; + disableTsServerFormatter = true; + }; + + }; + completion = { + luasnip.enable = true; + spell.enable = true; + }; + }; + }; + + plugins.lsp = + { + enable = true; + servers = { + # Average webdev LSPs + tsserver.enable = true; # TS/JS + cssls.enable = true; # CSS + tailwindcss.enable = true; # TailwindCSS + html.enable = true; # HTML + astro.enable = true; # AstroJS + phpactor.enable = true; # PHP + svelte.enable = false; # Svelte + vuels.enable = false; # Vue + pyright.enable = true; # Python + marksman.enable = true; # Markdown + nil-ls.enable = true; # Nix + dockerls.enable = true; # Docker + bashls.enable = true; # Bash + clangd.enable = true; # C/C++ + csharp-ls.enable = true; # C# + yamlls.enable = true; # YAML + + lua-ls = { + # Lua + enable = true; + settings.telemetry.enable = false; + }; + + # Rust + rust-analyzer = { + enable = true; + installRustc = false; # disabled so devshells work + installCargo = false; # disabled so devsellsh work + + }; + }; + }; + # Highlight word under cursor + plugins.illuminate = { + enable = true; + underCursor = false; + filetypesDenylist = [ + "Outline" + "TelescopePrompt" + "alpha" + "harpoon" + "reason" + ]; + }; + # Dashboard + plugins.alpha = { + enable = true; + theme = "dashboard"; + iconsEnabled = true; + }; + + + + plugins.cmp = { + enable = true; + settings = { + autoEnableSources = true; + experimental = { ghost_text = true; }; + performance = { + debounce = 60; + fetchingTimeout = 200; + maxViewEntries = 30; + }; + + snippet = { expand = "luasnip"; }; + formatting = { fields = [ "kind" "abbr" "menu" ]; }; + sources = [ + { name = "nvim_lsp"; } + { name = "emoji"; } + { + name = "buffer"; # text within current buffer + option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; + keywordLength = 3; + } + # { name = "copilot"; } # enable/disable copilot + { + name = "path"; # file system paths + keywordLength = 3; + } + { + name = "luasnip"; # snippets + keywordLength = 3; + } + ]; + + window = { + completion = { border = "solid"; }; + documentation = { border = "solid"; }; + }; + + mapping = { + "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.abort()"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.confirm({ select = true })"; + "" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })"; + }; + }; + }; + + plugins.cmp-nvim-lsp = { + enable = true; # LSP + }; + plugins.cmp-buffer = { + enable = true; + }; + plugins.cmp-path = { + enable = true; # file system paths + }; + plugins.cmp_luasnip = { + enable = true; # snippets + }; + + # TODO gen.nvim not in nixvim @@ -29,6 +177,7 @@ }; # todo-comments + plugins.todo-comments.enable = true; # TODO feline-nvim and theme for it @@ -56,28 +205,17 @@ enable = true; }; + # status bar + plugins.lualine = { + enable = true; + }; + # a cool summary searcher plugins.navbuddy.enable = true; - # language server - plugins.lsp = { - enable = true; - servers.rust-analyzer = { - enable = false; - # for devshells - installRustc = false; - installCargo = false; - }; - }; + # a completion engine using LSP - # TODO language detection - plugins.coq-nvim = { - enable = true; - installArtifacts = true; - settings.completion.always = true; - # TODO start with nvim - }; # languages plugins.rustaceanvim.enable = true; @@ -101,8 +239,8 @@ globals.mapleader = " "; # TODO shades of purple colorscheme - extraPlugins = [ pkgs.vimPlugins.gruvbox ]; - colorscheme = "gruvbox"; + #extraPlugins = [ pkgs.vimPlugins.gruvbox ]; + #colorscheme = "gruvbox"; # extraPlugins = [ # pkgs.vimUtils.buildVimPlugin # { diff --git a/nix/configs/picom.nix b/nix/configs/picom.nix index 16db888..31f7d24 100755 --- a/nix/configs/picom.nix +++ b/nix/configs/picom.nix @@ -6,50 +6,12 @@ vSync = false; # disable vsync to reduce input delay extraArgs = [ "-b" "--experimental-backends" ]; # enable deamon mode and experimental backends for blur - # idk what package is missing by 24.05 so i included all of them - package = - (pkgs.picom.overrideAttrs (oldAttrs: rec { - src = pkgs.fetchFromGitHub { - owner = "pijulius"; - repo = "picom"; - rev = "da21aa8ef70f9796bc8609fb495c3a1e02df93f9"; - hash = "sha256-rxGWAot+6FnXKjNZkMl1uHHHEMVSxm36G3VoV1vSXLA="; - }; - buildInputs = with pkgs; [ - dbus - libconfig - libdrm - libev - libGL - xorg.libX11 - xorg.libxcb - libxdg_basedir - xorg.libXext - xorg.libXinerama - libxml2 - libxslt - pcre - pixman - xorg.xcbutilimage - xorg.xcbutilrenderutil - xorg.xorgproto - ]; - nativeBuildInputs = with pkgs; [ - asciidoc - docbook_xml_dtd_45 - docbook_xsl - makeWrapper - meson - ninja - pkg-config - uthash - ]; - })); - settings = { + + # Blurring blur-method = "dual_kawase"; blur-size = 12; - blur-strength = 5; + blur-strength = 9; blur-background = true; blur-kern = "3x3box"; @@ -69,7 +31,7 @@ "90:class_g *= 'jamesdsp'" "90:class_g *= 'polybar'" "80:class_g *= 'codium'" - "80:class_g *= 'rofi'" + "80:class_g *= 'Rofi'" "80:class_g *= 'lutris'" "80:class_g *= 'Mumble'" "80:class_g *= 'Feishin'" @@ -81,30 +43,13 @@ # rounding corner-radius = 15; + round-borders = 1; use-damage = false; inactive-opacity = 1.0; frame-opacity = 1.0; inactive-opacity-override = false; - - fading = true; - fade-in-step = 0.03; - fade-out-step = 0.03; - - animations = true; - animation-for-open-window = "squeeze"; - animation-for-transient-window = "zoom"; - animation-for-unmap-window = "squeeze"; - animation-for-workspace-switch-in = "zoom"; - animation-for-workspace-switch-out = "auto"; - - animation-stiffness = 500; - animation-dampening = 40; - animation-window-mass = 1; - animation-delta = 7; - animation-force-steps = true; - }; }; } diff --git a/nix/configs/polybar/top.nix b/nix/configs/polybar/top.nix index 81dbd38..145007b 100644 --- a/nix/configs/polybar/top.nix +++ b/nix/configs/polybar/top.nix @@ -32,12 +32,6 @@ in # TODO include labels right into format for each module instea dof having a different module - "module/battery-label" = { - type = "custom/text"; - label = "BAT "; - label-foreground = "${colors.seperatorColor}"; - }; - "module/fs-label-system" = { type = "custom/text"; label = "SYS "; @@ -63,6 +57,7 @@ in warn-temperature = 85; label-warn-foreground = "${colors.warn}"; label-foreground = "${colors.fg}"; + label-background = "${colors.bg}"; thermal-zone = 0; zone-type = "x86_pkg_temp"; hwmon-path = "/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input"; @@ -104,21 +99,6 @@ in }; - "module/audio" = { - type = "internal/alsa"; - use-ui-max = false; - label-volume = "%percentage%%"; - label-muted = "muted"; - label-muted-foreground = "${colors.altfg}"; - }; - - "module/music" = { - type = "custom/script"; - interval = ".5"; - exec = "~/.config/scripts/music.sh"; - format = "