From bcf4783d95877e08ffe75babab676ec71d0c2c61 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Sun, 30 Jan 2022 21:19:35 +0200 Subject: [PATCH] feat: more work on nvim config --- dotfiles/neovim/init.lua | 25 ++++++++- dotfiles/neovim/lua/my/keymaps.lua | 4 +- flake.lock | 82 +++++++++++++++++++++++++++++- flake.nix | 15 +++++- modules/applications/default.nix | 1 + modules/applications/misc.nix | 1 - modules/applications/neovim.nix | 20 +++++--- modules/overlays/default.nix | 8 +-- modules/overlays/flakes.nix | 41 +++++++-------- modules/overlays/neovim.nix | 14 ----- 10 files changed, 152 insertions(+), 59 deletions(-) delete mode 100644 modules/overlays/neovim.nix diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index d205050..e4b0a2c 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -4,11 +4,32 @@ local g = vim.g -- a table to access global variables local opt = vim.opt -- to set options -- Basic options +opt.joinspaces = false -- No double spaces with join +opt.list = true -- Show some invisible characters + opt.number = true -- Show line numbers opt.relativenumber = true -- Relative line numbers +opt.scrolloff = 4 -- Lines of context +opt.shiftround = true -- Round indent +opt.shiftwidth = 2 -- Size of an indent +opt.termguicolors = true -- True color support + +opt.ignorecase = true -- Ignore case +opt.smartcase = true -- Do not ignore case with capitals + +opt.smartindent = true -- Insert indents automatically + +opt.splitbelow = true -- Put new windows below current +opt.splitright = true -- Put new windows right of current + +opt.wrap = false -- Disable line wrap +opt.wildmode = {'list', 'longest'} -- Command-line completion mode + -- Set theme -require('github-theme').setup() +require('github-theme').setup({ + theme_style = "light" +}) -- Import my other files -require('my.keymaps').setup() \ No newline at end of file +require('my.keymaps').setup() diff --git a/dotfiles/neovim/lua/my/keymaps.lua b/dotfiles/neovim/lua/my/keymaps.lua index f9a011f..3b01ae2 100644 --- a/dotfiles/neovim/lua/my/keymaps.lua +++ b/dotfiles/neovim/lua/my/keymaps.lua @@ -8,4 +8,6 @@ end function M.setup() map("i", "jj", "") -- Remap Esc to -end \ No newline at end of file +end + +return M \ No newline at end of file diff --git a/flake.lock b/flake.lock index 4c3de21..9366f9e 100644 --- a/flake.lock +++ b/flake.lock @@ -64,7 +64,38 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1641205782, + "narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { + "locked": { + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { "locked": { "lastModified": 1638122382, "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", @@ -115,6 +146,52 @@ "type": "github" } }, + "neovim-flake": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "dir": "contrib", + "lastModified": 1643521936, + "narHash": "sha256-qXtpIBP8wcUIAywqHehlxpaZnwG7spFsb36kDYQXCKQ=", + "owner": "neovim", + "repo": "neovim", + "rev": "9aaf7a2b4dfe9d3f9a1861e7ca85b6bbd4e34e05", + "type": "github" + }, + "original": { + "dir": "contrib", + "owner": "neovim", + "repo": "neovim", + "type": "github" + } + }, + "neovim-nightly-overlay": { + "inputs": { + "flake-compat": "flake-compat", + "neovim-flake": "neovim-flake", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1643530359, + "narHash": "sha256-RdCG+OXV3j57BFTyJSXy/Ko1LAM571JV9DiAtIdo0HM=", + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "rev": "e2eaf9379b15c9ee017b0505e9282204b2f29f80", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "type": "github" + } + }, "nixos-unstable": { "locked": { "lastModified": 1642903813, @@ -186,6 +263,7 @@ "easy-purescript-nix": "easy-purescript-nix", "githubNvimTheme": "githubNvimTheme", "home-manager": "home-manager", + "neovim-nightly-overlay": "neovim-nightly-overlay", "nixos-unstable": "nixos-unstable", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable", @@ -195,8 +273,8 @@ }, "vim-extra-plugins": { "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_2", "nixpkgs": "nixpkgs_2" }, "locked": { diff --git a/flake.nix b/flake.nix index 73d518d..9045ba5 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,9 @@ githubNvimTheme.url = "github:projekt0n/github-nvim-theme"; githubNvimTheme.flake = false; + neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; + neovim-nightly-overlay.inputs.nixpkgs.follows = "nixpkgs"; + vim-extra-plugins.url = "github:m15a/nixpkgs-vim-extra-plugins"; }; @@ -32,13 +35,23 @@ system = "x86_64-linux"; provideInputs = import ./modules/overlays/flakes.nix { inherit system; } inputs; + + overlays = { ... }: { + nix.registry.nixpkgs.flake = nixpkgs; + nixpkgs.overlays = [ + inputs.vim-extra-plugins.overlay + inputs.neovim-nightly-overlay.overlay + provideInputs + ]; + }; in { + nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { inherit system; modules = [ home-manager.nixosModules.home-manager - provideInputs + overlays ./hardware/laptop.nix ./configuration.nix ]; diff --git a/modules/applications/default.nix b/modules/applications/default.nix index 6f4b4da..7d24bf5 100644 --- a/modules/applications/default.nix +++ b/modules/applications/default.nix @@ -15,6 +15,7 @@ ./alacritty.nix ./rofi.nix ./postgres.nix + ./neovim.nix ]; } diff --git a/modules/applications/misc.nix b/modules/applications/misc.nix index 72e7253..8d78797 100644 --- a/modules/applications/misc.nix +++ b/modules/applications/misc.nix @@ -34,7 +34,6 @@ # vscodium vscode vim - my-neovim # emacs # chat apps diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix index 5bec22a..9f4de73 100644 --- a/modules/applications/neovim.nix +++ b/modules/applications/neovim.nix @@ -1,14 +1,20 @@ -{ wrapNeovim, neovim, tree-sitter, config-nvim, vimPlugins, vimExtraPlugins }: +{ pkgs, ... }: +let + config-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { + name = "config-nvim"; + src = ../../dotfiles/neovim; + }; +in { + home-manager.users.adrielus.programs.neovim = { + enable = true; + package = pkgs.neovim-nightly; -wrapNeovim neovim { - configure = { - customRC = '' + extraConfig = '' let g:disable_paq = v:true luafile ${config-nvim}/init.lua ''; - packages.default = with vimExtraPlugins; { - start = [ config-nvim vimExtraPlugins.github-nvim-theme ]; - }; + plugins = with pkgs.vimExtraPlugins; [ config-nvim github-nvim-theme ]; + }; } diff --git a/modules/overlays/default.nix b/modules/overlays/default.nix index 3e6a0a6..925f1e5 100644 --- a/modules/overlays/default.nix +++ b/modules/overlays/default.nix @@ -1,7 +1 @@ -{ pkgs, ... }: { - nixpkgs.overlays = [ - (import ./tweakSources.nix) - # neovim with my own config baked in - (import ./neovim.nix) - ]; -} +{ pkgs, ... }: { nixpkgs.overlays = [ (import ./tweakSources.nix) ]; } diff --git a/modules/overlays/flakes.nix b/modules/overlays/flakes.nix index 1a1b384..14f4d8d 100644 --- a/modules/overlays/flakes.nix +++ b/modules/overlays/flakes.nix @@ -1,32 +1,25 @@ { system }: { home-manager, nixpkgs, nixpkgs-unstable, nixos-unstable, easy-purescript-nix , easy-dhall-nix, z, agnoster, githubNvimTheme, vim-extra-plugins, ... }: -({ pkgs, ... }: { - nix.registry.nixpkgs.flake = nixpkgs; - nixpkgs.overlays = [ - vim-extra-plugins.overlay - (self: super: { - # inherit nixos-unstable; - unstable = import nixpkgs-unstable { - inherit system; - config.allowUnfree = true; - config.allowBroken = true; - }; +(self: super: { + unstable = import nixpkgs-unstable { + inherit system; + config.allowUnfree = true; + config.allowBroken = true; + }; - easy-purescript-nix = import easy-purescript-nix { inherit pkgs; }; - easy-dhall-nix = import easy-dhall-nix { inherit pkgs; }; + easy-purescript-nix = self.callPackage easy-purescript-nix { }; + easy-dhall-nix = self.callPackage easy-dhall-nix { }; - z = { - src = z; - name = "z"; - }; + z = { + src = z; + name = "z"; + }; - agnoster = { - src = agnoster; - name = "agnoster"; - }; + agnoster = { + src = agnoster; + name = "agnoster"; + }; - githubNvimTheme = githubNvimTheme; - }) - ]; + githubNvimTheme = githubNvimTheme; }) diff --git a/modules/overlays/neovim.nix b/modules/overlays/neovim.nix deleted file mode 100644 index 556eb78..0000000 --- a/modules/overlays/neovim.nix +++ /dev/null @@ -1,14 +0,0 @@ -final: prev: - -let - config-nvim = final.vimUtils.buildVimPluginFrom2Nix { - name = "config-nvim"; - src = ../../dotfiles/neovim; - }; - -in { - my-neovim = final.callPackage ../applications/neovim.nix { - neovim = final.neovim-nightly; - inherit config-nvim; - }; -}