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/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/init.lua b/home/lambda/config-files/nvim/init.lua new file mode 100644 index 0000000..5b7d53e --- /dev/null +++ b/home/lambda/config-files/nvim/init.lua @@ -0,0 +1,45 @@ +-- 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") + +-- 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 33c9132..332d698 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,131 @@ }; }; }; + + programs.nixvim = { + enable = true; + globals.mapleader = " "; + extraConfigLua = builtins.readFile ./config-files/nvim/init.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; + # sources = [ + # {name = "nvim_lsp";} + # {name = "path";} + # {name = "buffer";} + # ]; + #}; + nvim-cmp = { + enable = true; + autoEnableSources = true; + sources = [ + {name = "nvim_lsp";} + {name = "path";} + {name = "buffer";} + {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() + else + fallback() + end + end + ''; + modes = [ "i" "s" ]; + }; + }; + }; + telescope.enable = true; + cmp-nvim-lsp.enable = true; + cmp-nvim-lua.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; + }; + 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; # package = pkgs.hyprland; @@ -68,9 +195,11 @@ signal-desktop vesktop telegram-desktop + webex #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;