├── init.vim ├── LICENSE ├── README.md ├── flake.lock └── flake.nix /init.vim: -------------------------------------------------------------------------------- 1 | " place your custom init.vim here! 2 | colorscheme onedark 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 traxys 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Luca's super simple neovim flake configuration 2 | 3 | This configuration is heavily inspired by 4 | [jordanisaacs/neovim-flake](https://github.com/jordanisaacs/neovim-flake) 5 | and was forked, but heavily edited from [jordanisaacs/neovim-flake](https://github.com/jordanisaacs/neovim-flake). 6 | The problem with their flakes (and pretty much all other (neovim-)flakes) 7 | so far, is that the learning curve for flakes is so steep that only 8 | experts know how to create them. This leads to eiter overly complex 9 | examples or excessively trivial ones. 10 | 11 | The above flakes are to complicated for most people, which is why 12 | I simplified them into a small, single file. Now you can create your 13 | own neovim flake in no time! 14 | 15 | Just add your prefered plugins into the `inputs` section of `flake.nix` 16 | and overwrite `init.vim`! Done! 17 | 18 | ## Installation 19 | 20 | ### Run over the internet 21 | 22 | `nix run github:quoteme/neovim-flake /some/file` 23 | 24 | ### Run from a folder (for hacking ) 25 | 26 | Clone the repo and run `nix run /some/file` inside the new folder. 27 | 28 | ### Install system-wide 29 | 30 | Open `/etc/nixos/flake.nix` and add the following: 31 | 32 | ``` 33 | inputs = { 34 | # ...blabla... 35 | neovim-flake.url = "github:Quoteme/neovim-flake"; 36 | } 37 | 38 | outputs = {self, nixpkgs, ...}@attr: { 39 | nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { 40 | system = "x86_64-linux"; 41 | specialArgs = attrs; 42 | modules = [ 43 | ({ config, nixpkgs, ...}@inputs: 44 | # ...blabla... 45 | environment.systemPackages = with pkgs; [ 46 | # ...blabla... 47 | inputs.neovim-flake.defaultPackage.x86_64-linux 48 | ]; 49 | ) 50 | ]; 51 | } 52 | } 53 | ``` 54 | 55 | Note that `...blabla...` is a placeholder for any other configuration 56 | you might have set inside your `flake.nix`! 57 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "flake-utils": { 4 | "locked": { 5 | "lastModified": 1678901627, 6 | "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", 7 | "owner": "numtide", 8 | "repo": "flake-utils", 9 | "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", 10 | "type": "github" 11 | }, 12 | "original": { 13 | "owner": "numtide", 14 | "repo": "flake-utils", 15 | "type": "github" 16 | } 17 | }, 18 | "nixpkgs": { 19 | "locked": { 20 | "lastModified": 1679793451, 21 | "narHash": "sha256-JafTtgMDATE8dZOImBhWMA9RCn9AP8FVOpN+9K/tTlg=", 22 | "owner": "nixos", 23 | "repo": "nixpkgs", 24 | "rev": "0cd51a933d91078775b300cf0f29aa3495231aa2", 25 | "type": "github" 26 | }, 27 | "original": { 28 | "owner": "nixos", 29 | "ref": "nixpkgs-unstable", 30 | "repo": "nixpkgs", 31 | "type": "github" 32 | } 33 | }, 34 | "plugin_gitsigns": { 35 | "flake": false, 36 | "locked": { 37 | "lastModified": 1679495319, 38 | "narHash": "sha256-McgT3aQ21uiBRMbcHNf10frE2aJDO0TStSoc1Um0n20=", 39 | "owner": "lewis6991", 40 | "repo": "gitsigns.nvim", 41 | "rev": "ca473e28382f1524aa3d2b6f04bcf54f2e6a64cb", 42 | "type": "github" 43 | }, 44 | "original": { 45 | "owner": "lewis6991", 46 | "repo": "gitsigns.nvim", 47 | "type": "github" 48 | } 49 | }, 50 | "plugin_onedark-vim": { 51 | "flake": false, 52 | "locked": { 53 | "lastModified": 1665434351, 54 | "narHash": "sha256-Q/qmCbyppb40KojXRxCQLNK8OapStHJ90T33Mb75gFc=", 55 | "owner": "joshdick", 56 | "repo": "onedark.vim", 57 | "rev": "b6b5ffe31a195a3077338d7a506b905e4a51590f", 58 | "type": "github" 59 | }, 60 | "original": { 61 | "owner": "joshdick", 62 | "repo": "onedark.vim", 63 | "type": "github" 64 | } 65 | }, 66 | "root": { 67 | "inputs": { 68 | "flake-utils": "flake-utils", 69 | "nixpkgs": "nixpkgs", 70 | "plugin_gitsigns": "plugin_gitsigns", 71 | "plugin_onedark-vim": "plugin_onedark-vim" 72 | } 73 | } 74 | }, 75 | "root": "root", 76 | "version": 7 77 | } 78 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Luca's simple Neovim flake for easy configuration"; 3 | 4 | inputs = { 5 | nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 6 | flake-utils = { 7 | inputs.nixpkgs.follows = "nixpkgs"; 8 | url = "github:numtide/flake-utils"; 9 | }; 10 | 11 | # Theme 12 | "plugin_onedark-vim" = { 13 | url = "github:joshdick/onedark.vim"; 14 | flake = false; 15 | }; 16 | # Git 17 | "plugin_gitsigns" = { 18 | url = "github:lewis6991/gitsigns.nvim"; 19 | flake = false; 20 | }; 21 | }; 22 | 23 | outputs = { self, nixpkgs, flake-utils, ... }@inputs: 24 | # This line makes this package availeable for all systems 25 | # ("x86_64-linux", "aarch64-linux", "i686-linux", "x86_64-darwin",...) 26 | flake-utils.lib.eachDefaultSystem (system: 27 | let 28 | # Once we add this overlay to our nixpkgs, we are able to 29 | # use `pkgs.neovimPlugins`, which is a map of our plugins. 30 | # Each input in the format: 31 | # ``` 32 | # "plugin_yourPluginName" = { 33 | # url = "github:exampleAuthor/examplePlugin"; 34 | # flake = false; 35 | # }; 36 | # ``` 37 | # included in the `inputs` section is packaged to a (neo-)vim 38 | # plugin and can then be used via 39 | # ``` 40 | # pkgs.neovimPlugins.yourPluginName 41 | # ``` 42 | pluginOverlay = final: prev: 43 | let 44 | inherit (prev.vimUtils) buildVimPluginFrom2Nix; 45 | treesitterGrammars = prev.tree-sitter.withPlugins (_: prev.tree-sitter.allGrammars); 46 | plugins = builtins.filter 47 | (s: (builtins.match "plugin_.*" s) != null) 48 | (builtins.attrNames inputs); 49 | plugName = input: 50 | builtins.substring 51 | (builtins.stringLength "plugin_") 52 | (builtins.stringLength input) 53 | input; 54 | buildPlug = name: buildVimPluginFrom2Nix { 55 | pname = plugName name; 56 | version = "master"; 57 | src = builtins.getAttr name inputs; 58 | 59 | # Tree-sitter fails for a variety of lang grammars unless using :TSUpdate 60 | # For now install imperatively 61 | #postPatch = 62 | # if (name == "nvim-treesitter") then '' 63 | # rm -r parser 64 | # ln -s ${treesitterGrammars} parser 65 | # '' else ""; 66 | }; 67 | in 68 | { 69 | neovimPlugins = builtins.listToAttrs (map 70 | (plugin: { 71 | name = plugName plugin; 72 | value = buildPlug plugin; 73 | }) 74 | plugins); 75 | }; 76 | 77 | # Apply the overlay and load nixpkgs as `pkgs` 78 | pkgs = import nixpkgs { 79 | inherit system; 80 | overlays = [ 81 | pluginOverlay 82 | ]; 83 | }; 84 | 85 | # neovimBuilder is a function that takes your prefered 86 | # configuration as input and just returns a version of 87 | # neovim where the default config was overwritten with your 88 | # config. 89 | # 90 | # Parameters: 91 | # customRC | your init.vim as string 92 | # viAlias | allow calling neovim using `vi` 93 | # vimAlias | allow calling neovim using `vim` 94 | # start | The set of plugins to load on every startup 95 | # | The list is in the form ["yourPluginName" "anotherPluginYouLike"]; 96 | # | 97 | # | Important: The default is to load all plugins, if 98 | # | `start = [ "blabla" "blablabla" ]` is 99 | # | not passed as an argument to neovimBuilder! 100 | # | 101 | # | Make sure to add: 102 | # | ``` 103 | # | "plugin_yourPluginName" = { 104 | # | url = "github:exampleAuthor/examplePlugin"; 105 | # | flake = false; 106 | # | }; 107 | # | 108 | # | "plugin_anotherPluginYouLike" = { 109 | # | url = "github:exampleAuthor/examplePlugin"; 110 | # | flake = false; 111 | # | }; 112 | # | ``` 113 | # | to your imports! 114 | # opt | List of optional plugins to load only when 115 | # | explicitly loaded from inside neovim 116 | neovimBuilder = { customRC ? "" 117 | , viAlias ? true 118 | , vimAlias ? true 119 | , start ? builtins.attrValues pkgs.neovimPlugins 120 | , opt ? [] 121 | , debug ? false }: 122 | let 123 | myNeovimUnwrapped = pkgs.neovim-unwrapped.overrideAttrs (prev: { 124 | propagatedBuildInputs = with pkgs; [ pkgs.stdenv.cc.cc.lib ]; 125 | }); 126 | in 127 | pkgs.wrapNeovim myNeovimUnwrapped { 128 | inherit viAlias; 129 | inherit vimAlias; 130 | configure = { 131 | customRC = customRC; 132 | packages.myVimPackage = with pkgs.neovimPlugins; { 133 | start = start; 134 | opt = opt; 135 | }; 136 | }; 137 | }; 138 | in 139 | rec { 140 | defaultApp = apps.nvim; 141 | defaultPackage = packages.neovimLuca; 142 | 143 | apps.nvim = { 144 | type = "app"; 145 | program = "${defaultPackage}/bin/nvim"; 146 | }; 147 | 148 | packages.neovimLuca = neovimBuilder { 149 | # the next line loads a trivial example of a init.vim: 150 | customRC = pkgs.lib.readFile ./init.vim; 151 | # if you wish to only load the onedark-vim colorscheme: 152 | # start = with pkgs.neovimPlugins; [ onedark-vim ]; 153 | }; 154 | } 155 | ); 156 | } 157 | --------------------------------------------------------------------------------