{ # Snowfall Lib provides a customized `lib` instance with access to your flake's library # as well as the libraries available from your flake's inputs. lib, # An instance of `pkgs` with your overlays and packages applied is also available. pkgs, # You also have access to your flake's inputs. inputs, # Additional metadata is provided by Snowfall Lib. system, # The system architecture for this host (eg. `x86_64-linux`). target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). format, # A normalized name for the system target (eg. `iso`). virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. systems, # An attribute map of your defined hosts. # All other arguments come from the module system. config, ... }: let cfg = config.modules.neovim; in { options.modules.neovim = { enable = lib.mkOption { default = false; }; }; imports = [ inputs.nixvim.homeManagerModules.nixvim ]; config = lib.mkIf cfg.enable { home.sessionVariables = { EDITOR = "nvim"; VISUAL = "nvim"; }; home.packages = with pkgs; [ git gnumake gcc ripgrep fd stylua black nixfmt-rfc-style # nixfmt ]; programs.nixvim = { enable = true; viAlias = true; vimAlias = true; colorschemes.catppuccin = { enable = true; settings.flavour = "mocha"; }; globals.mapleader = " "; opts = { number = false; relativenumber = false; }; clipboard.register = "unnamedplus"; # Use system clipboard keymaps = [ { action = "Telescope live_grep"; key = "/"; } { action = "Telescope find_files"; key = ""; } { action = "Telescope file_browser"; key = "."; } { action = "Neogit"; key = "gg"; } { key = ""; action = "lua require('conform').format()write"; mode = [ "i" "x" "n" "s" ]; } ]; plugins = { lualine.enable = true; commentary.enable = true; which-key.enable = true; treesitter.enable = true; # enables all grammar packages neogit.enable = true; # like magit trouble.enable = true; # Shows file trees oil = { enable = true; settings = { view_options.show_hidden = true; }; }; # Code formatting conform-nvim = { enable = true; formattersByFt = with pkgs; { lua = [ "stylua" ]; python = [ "black" ]; nix = [ "nixfmt" ]; }; # extraOptions = { # default_format_opts.lsp_format = "fallback"; # }; }; # autocomplete cmp = { enable = true; autoEnableSources = true; settings.sources = [ { name = "nvim_lsp"; } { name = "path"; } { name = "buffer"; } ]; settings.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.confirm({ select = true })"; }; }; # Fuzzy finder telescope = { enable = true; settings.defaults.mappings = { i = { "".__raw = "require('telescope.actions').move_selection_next"; "".__raw = "require('telescope.actions').move_selection_previous"; "".__raw = "require('telescope.actions').select_default"; }; }; extensions = { fzf-native.enable = true; file-browser = { enable = true; settings = { hidden = true; # show hidden files follow_symlinks = true; no_ignore = true; }; }; }; }; lsp = { enable = true; servers = { rust-analyzer = { enable = true; installCargo = true; installRustc = true; }; nixd.enable = true; pyright.enable = true; dockerls.enable = true; lua-ls.enable = true; }; }; }; }; }; }