From 9f583221db246b09c747878ffd22a4ee4a3a0a7a Mon Sep 17 00:00:00 2001 From: xqtc161 Date: Sun, 28 Jan 2024 22:51:43 +0100 Subject: [PATCH 1/4] adding nixvim; using latest kernel --- flake.lock | 237 ++++++++++++++++++++++++++++++++++++- flake.nix | 16 ++- home/lambda/default.nix | 27 ++++- hosts/asmodeus/default.nix | 22 +++- overlays/nixvim.nix | 3 + 5 files changed, 296 insertions(+), 9 deletions(-) create mode 100644 overlays/nixvim.nix diff --git a/flake.lock b/flake.lock index 75338ff..4a3d00f 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,44 @@ { "nodes": { + "beautysh": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "poetry2nix": "poetry2nix", + "utils": "utils" + }, + "locked": { + "lastModified": 1680308980, + "narHash": "sha256-aUEHV0jk2qIFP3jlsWYWhBbm+w/N9gzH3e4I5DcdB5s=", + "owner": "lovesegfault", + "repo": "beautysh", + "rev": "9845efc3ea3e86cc0d41465d720a47f521b2799c", + "type": "github" + }, + "original": { + "owner": "lovesegfault", + "repo": "beautysh", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -18,6 +57,64 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -55,11 +152,104 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "beautysh": "beautysh", + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1704297403, + "narHash": "sha256-g7+4SiXDGzIlWIfANyH1J5CeEaY+Alah6KOm6IO4nIk=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "b3ea5256e07ee9105060cffa075028402946bd63", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "nixos-23.11", + "repo": "nixvim", + "type": "github" + } + }, + "poetry2nix": { + "inputs": { + "flake-utils": [ + "nixvim", + "beautysh", + "utils" + ], + "nixpkgs": [ + "nixvim", + "beautysh", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1658665240, + "narHash": "sha256-/wkx7D7enyBPRjIkK0w7QxLQhzEkb3UxNQnjyc3FTUI=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "8b8edc85d24661d5a6d0d71d6a7011f3e699780f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils_3", + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1703939133, + "narHash": "sha256-Gxe+mfOT6bL7wLC/tuT2F+V+Sb44jNr8YsJ3cyIl4Mo=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "9d3d7e18c6bc4473d7520200d4ddab12f8402d38", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nixvim": "nixvim" } }, "systems": { @@ -76,6 +266,51 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "locked": { + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index b93d3ad..601f0c7 100644 --- a/flake.nix +++ b/flake.nix @@ -7,12 +7,19 @@ inputs.nixpkgs.follows = "nixpkgs"; }; }; + inputs.nixvim = { + # If you are not running an unstable channel of nixpkgs, select the corresponding branch of nixvim. + url = "github:nix-community/nixvim/nixos-23.11"; - outputs = inputs @ {self, nixpkgs, home-manager, ...}: let + inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs @ {self, nixpkgs, home-manager, nixvim, ...}: let lib = nixpkgs.lib; util = (import ./overlays/util.nix {} {}).util; system = "x86_64-linux"; - pkgs = import nixpkgs { inherit system; overlays = util.nixFilesIn ./overlays; }; + pkgs = import nixpkgs { inherit system; overlays = + util.nixFilesIn ./overlays; }; in { #nixosConfigurations = { # lambda = lib.nixosSystem { @@ -27,8 +34,9 @@ home-manager.useUserPackages = true; home-manager.extraSpecialArgs = inputs; - home-manager.users.xqtc = {...}: {imports = [ ./home/lambda ]; }; - }]; + home-manager.users.xqtc = {...}: {imports = [ ./home/lambda nixvim.homeManagerModules.nixvim ]; }; + } + ]; }); }; } diff --git a/home/lambda/default.nix b/home/lambda/default.nix index 33c9132..50adc7d 100644 --- a/home/lambda/default.nix +++ b/home/lambda/default.nix @@ -1,6 +1,8 @@ { config, pkgs, lib, ... }: - { + #imports = [ + # inputs.nixvim.homeManagerModules.nixvim + #]; home.username = "xqtc"; home.homeDirectory = "/home/xqtc"; @@ -39,6 +41,28 @@ }; }; }; + + programs.nixvim = { + enable = true; + colorschemes.catppuccin.enable = true; + plugins = { + lsp = { + enable = true; + servers = { + rust-analyzer = { + enable = true; + installLanguageServer = false; + }; + nil_ls.enable = true; + }; + }; + gitsigns.enable = true; + treesitter.enable = true; + nvim-cmp.enable = true; + telescope.enable = true; + cmp-nvim-lsp.enable = true; + }; + }; #wayland.windowManager.hyprland = { # enable = true; # package = pkgs.hyprland; @@ -71,6 +95,7 @@ #schildichat-desktop neovide + jetbrains.rust-rover yubioath-flutter diff --git a/hosts/asmodeus/default.nix b/hosts/asmodeus/default.nix index fcc2412..098516d 100644 --- a/hosts/asmodeus/default.nix +++ b/hosts/asmodeus/default.nix @@ -42,13 +42,15 @@ nvidiaSettings = true; - package = config.boot.kernelPackages.nvidiaPackages.stable; + package = config.boot.kernelPackages.nvidiaPackages.production; }; # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + boot.kernelPackages = pkgs.linuxPackages_latest; + networking.hostName = "asmodeus"; # Define your hostname. # Pick only one of the below networking options. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. @@ -139,6 +141,8 @@ jellyfin-ffmpeg ]; + + #programs.nix-ld.enable = true; # Some programs need SUID wrappers, can be configured further or are # started in user sessions. @@ -153,10 +157,22 @@ services.jellyfin.enable = true; services.jellyfin.user = "xqtc"; - + services = { + syncthing = { + enable = true; + user = "xqtc"; + dataDir = "/home/xqtc/Documents"; # Default folder for new synced folders + configDir = "/home/xqtc/Documents/.config/syncthing"; # Folder for Syncthing's settings and keys + }; + }; # Enable the OpenSSH daemon. services.openssh.enable = true; + services.mysql = { + enable = true; + package = pkgs.mariadb; + }; + services.resolved.enable = true; services.mullvad-vpn = { @@ -168,7 +184,7 @@ services.tailscale.enable = true; # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; + networking.firewall.allowedTCPPorts = [ 8096 8080 ]; # networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. # networking.firewall.enable = false; diff --git a/overlays/nixvim.nix b/overlays/nixvim.nix new file mode 100644 index 0000000..97a9cda --- /dev/null +++ b/overlays/nixvim.nix @@ -0,0 +1,3 @@ +self: super: { + nixneovim.overlays.default; +} From b5032dcb8b51720a7b735fac0cef6c39554690c9 Mon Sep 17 00:00:00 2001 From: xqtc161 Date: Mon, 29 Jan 2024 11:04:52 +0100 Subject: [PATCH 2/4] Further nixvim configuration --- home/lambda/config-files/nvim/keybinds.lua | 12 +++ home/lambda/default.nix | 95 ++++++++++++++++++---- overlays/nixvim.nix | 3 - 3 files changed, 89 insertions(+), 21 deletions(-) create mode 100644 home/lambda/config-files/nvim/keybinds.lua delete mode 100644 overlays/nixvim.nix diff --git a/home/lambda/config-files/nvim/keybinds.lua b/home/lambda/config-files/nvim/keybinds.lua new file mode 100644 index 0000000..2d81ce8 --- /dev/null +++ b/home/lambda/config-files/nvim/keybinds.lua @@ -0,0 +1,12 @@ +-- Switch between splits +vim.keymap.set("n", "", "l") +vim.keymap.set("n", "", "h") +vim.keymap.set("n", "", "k") +vim.keymap.set("n", "", "j") + +-- Escape for exiting terminal mode +vim.keymap.set('t', '', '') + +-- move selection linewise +vim.keymap.set('v', 'J', ":m '>+1gv=gv") +vim.keymap.set('v', 'K', ":m '<-2gv=gv") diff --git a/home/lambda/default.nix b/home/lambda/default.nix index 50adc7d..9425a82 100644 --- a/home/lambda/default.nix +++ b/home/lambda/default.nix @@ -43,25 +43,84 @@ }; programs.nixvim = { - enable = true; - colorschemes.catppuccin.enable = true; - plugins = { - lsp = { - enable = true; - servers = { - rust-analyzer = { - enable = true; - installLanguageServer = false; - }; - nil_ls.enable = true; - }; - }; - gitsigns.enable = true; - treesitter.enable = true; - nvim-cmp.enable = true; - telescope.enable = true; - cmp-nvim-lsp.enable = true; + enable = true; + globals.mapleader = " "; + extraConfigLua = builtins.readFile ./config-files/nvim/keybinds.lua; + + options = { + number = true; # Show line numbers + relativenumber = true; # Show relative line numbers + + shiftwidth = 2; # Tab width should be 2 + }; + + colorschemes.catppuccin.enable = true; + plugins = { + lsp = { + enable = true; + servers = { + rust-analyzer = { + enable = true; + installLanguageServer = false; + installCargo = false; + installRustc = false; + }; + nil_ls.enable = true; + }; }; + gitsigns.enable = true; + fugitive.enable = true; + treesitter.enable = true; + nvim-cmp.enable = true; + telescope.enable = true; + cmp-nvim-lsp.enable = true; + noice.enable = true; + neo-tree.enable = true; + presence-nvim.enable = true; + crates-nvim.enable = true; + alpha = { + enable = true; + }; + bufferline.enable = true; + }; + keymaps = [ + { + mode = "n"; + key = "ff"; + options.silent = true; + action = "Telescope find_files"; + } + { + mode = "n"; + key = "Gp"; + action = "Git pull"; + } + { + mode = "n"; + key = "GP"; + action = "Git push"; + } + { + mode = "n"; + key = "Gc"; + action = "Git commit"; + } + { + mode = "n"; + key = "Ga"; + action = "Git add ."; + } + { + mode = "n"; + key = "Gd"; + action = "Git diff"; + } + { + mode = "n"; + key = "nt"; + action = "Neotree toggle left"; + } + ]; }; #wayland.windowManager.hyprland = { # enable = true; diff --git a/overlays/nixvim.nix b/overlays/nixvim.nix deleted file mode 100644 index 97a9cda..0000000 --- a/overlays/nixvim.nix +++ /dev/null @@ -1,3 +0,0 @@ -self: super: { - nixneovim.overlays.default; -} From e7c426cd85608431e03535c86b9a60d5db33f66c Mon Sep 17 00:00:00 2001 From: xqtc161 Date: Mon, 29 Jan 2024 11:30:14 +0100 Subject: [PATCH 3/4] Adding working config for LSP and CMP --- home/lambda/config-files/nvim/keybinds.lua | 32 ++++++++++++++++ home/lambda/default.nix | 44 +++++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/home/lambda/config-files/nvim/keybinds.lua b/home/lambda/config-files/nvim/keybinds.lua index 2d81ce8..b94d799 100644 --- a/home/lambda/config-files/nvim/keybinds.lua +++ b/home/lambda/config-files/nvim/keybinds.lua @@ -10,3 +10,35 @@ vim.keymap.set('t', '', '') -- move selection linewise vim.keymap.set('v', 'J', ":m '>+1gv=gv") vim.keymap.set('v', 'K', ":m '<-2gv=gv") + +-- Neovide +if vim.g.neovide then + vim.g.neovide_cursor_vfx_mode = "ripple" + + vim.g.neovide_cursor_vfx_particle_density = 30.0 + vim.g.neovide_transparency = 1.0 + + local font_name = "Hack Nerd Font Mono:h" + local font_size = 20 + vim.o.guifont = font_name .. tostring(font_size) + vim.g.neovide_profiler = false + vim.g.neovide_hide_mouse_when_typing = true + -- Fullscreen keymapping + vim.keymap.set("n", "FF", function() + if vim.g.neovide_fullscreen then + vim.g.neovide_fullscreen = false + else + vim.g.neovide_fullscreen = true + end + end) + vim.keymap.set("n", "", function() + font_size = font_size + 1 + vim.o.guifont = font_name .. tostring(font_size) + end) + vim.keymap.set("n", "", function() + if font_size >= 1 then + font_size = font_size - 1 + vim.o.guifont = font_name .. tostring(font_size) + end + end) +end diff --git a/home/lambda/default.nix b/home/lambda/default.nix index 9425a82..03e214b 100644 --- a/home/lambda/default.nix +++ b/home/lambda/default.nix @@ -71,13 +71,55 @@ gitsigns.enable = true; fugitive.enable = true; treesitter.enable = true; - nvim-cmp.enable = true; + #nvim-cmp = { + # enable = true; + # sources = [ + # {name = "nvim_lsp";} + # {name = "path";} + # {name = "buffer";} + # ]; + #}; + nvim-cmp = { + enable = true; + autoEnableSources = true; + sources = [ + {name = "nvim_lsp";} + {name = "path";} + {name = "buffer";} + {name = "luasnip";} + ]; + + mapping = { + "" = "cmp.mapping.confirm({ select = true })"; + "" = { + action = '' + function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end + ''; + modes = [ "i" "s" ]; + }; + }; + }; telescope.enable = true; cmp-nvim-lsp.enable = true; noice.enable = true; + notify.enable = true; + luasnip.enable = true; neo-tree.enable = true; presence-nvim.enable = true; crates-nvim.enable = true; + fidget.enable = true; alpha = { enable = true; }; From 4524e2894b1d50f5aceccc8ba70ef6c5fb20bebd Mon Sep 17 00:00:00 2001 From: xqtc161 Date: Mon, 29 Jan 2024 13:36:54 +0100 Subject: [PATCH 4/4] further nixvim config --- home/lambda/config-files/nvim/cmp/snippet.lua | 6 ++++++ home/lambda/config-files/nvim/{keybinds.lua => init.lua} | 1 + home/lambda/default.nix | 9 ++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 home/lambda/config-files/nvim/cmp/snippet.lua rename home/lambda/config-files/nvim/{keybinds.lua => init.lua} (99%) diff --git a/home/lambda/config-files/nvim/cmp/snippet.lua b/home/lambda/config-files/nvim/cmp/snippet.lua new file mode 100644 index 0000000..b71f2d2 --- /dev/null +++ b/home/lambda/config-files/nvim/cmp/snippet.lua @@ -0,0 +1,6 @@ +local luasnip = require('luasnip') +snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, +}, diff --git a/home/lambda/config-files/nvim/keybinds.lua b/home/lambda/config-files/nvim/init.lua similarity index 99% rename from home/lambda/config-files/nvim/keybinds.lua rename to home/lambda/config-files/nvim/init.lua index b94d799..5b7d53e 100644 --- a/home/lambda/config-files/nvim/keybinds.lua +++ b/home/lambda/config-files/nvim/init.lua @@ -42,3 +42,4 @@ if vim.g.neovide then end end) end + diff --git a/home/lambda/default.nix b/home/lambda/default.nix index 03e214b..332d698 100644 --- a/home/lambda/default.nix +++ b/home/lambda/default.nix @@ -45,7 +45,7 @@ programs.nixvim = { enable = true; globals.mapleader = " "; - extraConfigLua = builtins.readFile ./config-files/nvim/keybinds.lua; + extraConfigLua = builtins.readFile ./config-files/nvim/init.lua; options = { number = true; # Show line numbers @@ -89,19 +89,20 @@ {name = "luasnip";} ]; + snippet.expand = "luasnip"; + mapping = { "" = "cmp.mapping.confirm({ select = true })"; "" = { action = '' function(fallback) + local luasnip = require 'luasnip' if cmp.visible() then cmp.select_next_item() elseif luasnip.expandable() then luasnip.expand() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() - elseif check_backspace() then - fallback() else fallback() end @@ -113,6 +114,7 @@ }; telescope.enable = true; cmp-nvim-lsp.enable = true; + cmp-nvim-lua.enable = true; noice.enable = true; notify.enable = true; luasnip.enable = true; @@ -193,6 +195,7 @@ signal-desktop vesktop telegram-desktop + webex #schildichat-desktop neovide