From cee77dd6afcfac9cc71ada195fc19c1e7fefd49b Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Tue, 21 May 2024 23:41:23 +0200 Subject: [PATCH] working nixvim! --- flake.nix | 6 +- hosts/default.nix | 1 + hosts/vali/mars/configuration.nix | 2 +- hosts/vali/mars/programs.nix | 1 + modules/editors/default.nix | 2 +- modules/editors/helix.nix | 7 +-- modules/editors/nixvim.nix | 97 ++++++++++++++++++++++++++++--- modules/other/xdg.nix | 4 +- 8 files changed, 100 insertions(+), 20 deletions(-) diff --git a/flake.nix b/flake.nix index 8b971a7..04209af 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "lololo"; + description = "My NixOS config flake"; outputs = inputs@{ self, nixpkgs, ... }: { inherit (nixpkgs) lib; nixosConfigurations = import ./hosts { inherit inputs; }; @@ -51,8 +51,8 @@ spicetify-nix.url = "github:the-argus/spicetify-nix"; nur = { url = "github:nix-community/NUR"; }; nixvim = { - url = "github:nix-community/nixvim"; - inputs.nixpkgs.follows = "nixpkgs"; + url = "github:nix-community/nixvim"; + inputs.nixpkgs.follows = "nixpkgs"; }; agenix.url = "github:ryantm/agenix"; diff --git a/hosts/default.nix b/hosts/default.nix index c0bf28d..00094c1 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -12,6 +12,7 @@ in { ../modules inputs.home-manager.nixosModules.home-manager inputs.agenix.nixosModules.default + inputs.nixvim.nixosModules.nixvim ]; }; diff --git a/hosts/vali/mars/configuration.nix b/hosts/vali/mars/configuration.nix index 3dbe848..54602cf 100644 --- a/hosts/vali/mars/configuration.nix +++ b/hosts/vali/mars/configuration.nix @@ -64,7 +64,7 @@ editors = { emacs = { enable = false; - doom.enable = false; + doom.enable = false; }; helix.enable = true; kakoune.enable = true; diff --git a/hosts/vali/mars/programs.nix b/hosts/vali/mars/programs.nix index 2f980fd..e29e94a 100644 --- a/hosts/vali/mars/programs.nix +++ b/hosts/vali/mars/programs.nix @@ -75,6 +75,7 @@ in { polkit python3 qbittorrent + ripgrep rustdesk scc scummvm diff --git a/modules/editors/default.nix b/modules/editors/default.nix index 3087c24..bb43191 100644 --- a/modules/editors/default.nix +++ b/modules/editors/default.nix @@ -1 +1 @@ -_: { imports = [ ./emacs.nix ./helix.nix ./kakoune.nix ]; } +_: { imports = [ ./emacs.nix ./helix.nix ./kakoune.nix ./nixvim.nix ]; } diff --git a/modules/editors/helix.nix b/modules/editors/helix.nix index 2e6918b..0a84f56 100644 --- a/modules/editors/helix.nix +++ b/modules/editors/helix.nix @@ -1,12 +1,11 @@ { config, lib, pkgs, ... }: -with lib; let cfg = config.modules.editors.helix; username = config.modules.other.system.username; in { - options.modules.editors.helix.enable = mkEnableOption "helix"; + options.modules.editors.helix.enable = lib.mkEnableOption "helix"; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { home-manager.users.${username} = { programs.helix = { enable = true; @@ -20,7 +19,7 @@ in { cursor-shape = { insert = "bar"; }; statusline.left = - [ "mode" "spinner" "version-control" "file-name" ]; + [ "mode" "spinner" "version-control" "file-name" ]; }; keys.normal = { C-g = diff --git a/modules/editors/nixvim.nix b/modules/editors/nixvim.nix index 25f7edc..44b093d 100644 --- a/modules/editors/nixvim.nix +++ b/modules/editors/nixvim.nix @@ -1,14 +1,93 @@ -{pkgs, config, lib, ...}: -with lib; -let - cfg = config.modules.editors.nixvim; - inherit (inputs.nixvim.packges.${pkgs.system}) nixvim; +{ config, lib, ... }: +let cfg = config.modules.editors.nixvim; in { - options.modules.editors.nivim.enable = mkEnableOption "nixvim"; - config = mkIf cfg.enable { + options.modules.editors.nixvim.enable = lib.mkEnableOption "nixvim"; + + config = lib.mkIf cfg.enable { programs.nixvim = { - enable = true; + enable = true; + colorschemes.gruvbox.enable = true; + options = { + number = true; + relativenumber = true; + shiftwidth = 2; + scrolloff = 8; + }; + plugins = { + lightline.enable = true; + lsp = { + enable = true; + servers = { + nixd.enable = true; + lua-ls.enable = true; + }; + }; + cmp = { + enable = true; + settings = { + sources = [ { name = "nvim_lsp"; } { name = "buffer"; } { name = "path"; } ]; + 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; + extensions = { + fzf-native = { + enable = true; + settings = { + fuzzy = true; + override_file_sorter = true; + override_generic_sorter = true; + case_mode = "smart_case"; + }; + }; + }; + }; + treesitter.enable = true; + treesitter-context.enable = true; + comment.enable = true; + gitblame.enable = true; + trouble.enable = true; + todo-comments.enable = true; + fugitive.enable = true; + nvim-autopairs.enable = true; + diffview.enable = true; + oil.enable = true; + undotree.enable = true; + fzf-lua.enable = true; + surround.enable = true; + lazygit.enable = true; + # Theming + gitsigns.enable = true; + # barbar.enable = true; + lualine = { + enable = true; + #theme = "palenight"; + }; + nix.enable = true; + zig.enable = true; + + }; }; }; - } diff --git a/modules/other/xdg.nix b/modules/other/xdg.nix index cefe233..a96a69b 100644 --- a/modules/other/xdg.nix +++ b/modules/other/xdg.nix @@ -3,13 +3,13 @@ let username = config.modules.other.system.username; hmCfg = config.home-manager.users.${username}; - primary_browser = "firefox-schizo.desktop"; + primary_browser = "Schizofox.desktop"; mail_client = "thunderbird.desktop"; file_manager = "nautilus.desktop"; media_player = "mpv.desktop"; image_viewer = "imv.desktop"; text_editor = "helix.desktop"; - terminal = "kitty.desktop"; + terminal = "foot.desktop"; in { environment.sessionVariables = { TERMINAL = "${terminal}"; };