diff --git a/default.nix b/default.nix deleted file mode 100644 index e597b612..00000000 --- a/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -(import ( - let - lock = builtins.fromJSON (builtins.readFile ./flake.lock); - inherit (lock.nodes.flake-compat.locked) url rev narHash; - in - builtins.fetchTarball { - url = "${url}/archive/${rev}.tar.gz"; - sha256 = narHash; - } - ) { - src = ./.; - copySourceTreeToStore = false; - useBuiltinsFetchTree = true; - }) -.defaultNix diff --git a/docs/manual/installation/modules/flakes.md b/docs/manual/installation/modules/flakes.md deleted file mode 100644 index 273d2b00..00000000 --- a/docs/manual/installation/modules/flakes.md +++ /dev/null @@ -1,33 +0,0 @@ -### Prerequisites {#sec-flakes-prerequisites} - -To install nvf with flakes, you must make sure the following requirements are -met. - -1. Nix 2.4 or later must be installed. You may use `nix-shell` to get a later - version of Nix from nixpkgs. -2. Flake-related experimental features must be enabled. Namely, you need - `nix-command` and `flakes`. Some Nix vendors enable those by default, please - consult their documentation if you are not using mainstream Nix. - - When using NixOS, add the following to your `configuration.nix` and rebuild - your system. - - ```nix - nix.settings.experimental-features = "nix-command flakes"; - ``` - - - If you are not using NixOS, add the following to `nix.conf` (located at - `~/.config/nix/` or `/etc/nix/nix.conf`). - - ```bash - experimental-features = nix-command flakes - ``` - - - You may need to restart the Nix daemon with, for example, - `sudo systemctl restart nix-daemon.service`. - - - Alternatively, you can enable flakes on a per-command basis with the - following additional flags to `nix` and `home-manager`: - - ```sh - $ nix --extra-experimental-features "nix-command flakes" - ``` diff --git a/docs/manual/installation/modules/home-manager.md b/docs/manual/installation/modules/home-manager.md index 37d35e2b..2b359af5 100644 --- a/docs/manual/installation/modules/home-manager.md +++ b/docs/manual/installation/modules/home-manager.md @@ -5,18 +5,9 @@ inside the home-manager configuration without having to call for the wrapper yourself. It is the recommended way to use **nvf** alongside the NixOS module depending on your needs. -## With Flakes {#sec-hm-flakes} - -```{=include=} -flakes.md -``` - -### Usage {#sec-hm-flakes-usage} - -To use **nvf** with flakes, we first need to add the input to our `flake.nix`. +To use it, we first add the input flake. ```nix -# flake.nix { inputs = { # Optional, if you intend to follow nvf's obsidian-nvim input @@ -25,7 +16,7 @@ To use **nvf** with flakes, we first need to add the input to our `flake.nix`. # Required, nvf works best and only directly supports flakes nvf = { - url = "github:NotAShelf/nvf"; + url = "github:notashelf/nvf"; # You can override the input nixpkgs to follow your system's # instance of nixpkgs. This is safe to do as nvf does not depend # on a binary cache. @@ -34,8 +25,6 @@ To use **nvf** with flakes, we first need to add the input to our `flake.nix`. # for example: inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs }; - - # ... }; } ``` @@ -50,7 +39,7 @@ Followed by importing the home-manager module somewhere in your configuration. } ``` -### Example Installation {#sec-example-installation-hm} +## Example Installation {#sec-example-installation-hm} ```nix { @@ -77,8 +66,7 @@ Once the module is properly imported by your host, you will be able to use the `programs.nvf` module option anywhere in your configuration in order to configure **nvf**. -```nix -{ +```nix{ programs.nvf = { enable = true; # your settings need to go into the settings attribute set @@ -101,45 +89,3 @@ installation sections of the manual. You may find all available options in the [appendix](https://notashelf.github.io/nvf/options) ::: - -## Without Flakes {#sec-hm-flakeless} - -As of v0.8, it is possible to install **nvf** on a system if you are not using -flakes. This is possible thanks to the flake-compat project. - -To get started, you must fetch the repository using `builtins.fetchTarball` or a -similar mechanism. - -```nix -# home.nix -let - nvf = import (builtins.fetchTarball { - url = "https://github.com/notashelf/nvf/archive/.tar.gz"; - # Optionally, you can add 'sha256' for verification and caching - # sha256 = ""; - }); -in { - imports = [ - # Import the NixOS module from your fetched input - nvf.homeManagerModules.nvf - ]; - - # Once the module is imported, you may use `programs.nvf` as exposed by the - # NixOS module. - programs.nvf.enable = true; -} -``` - -[npins]: https://github.com/andir/npins -[niv]: https://github.com/nmattia/niv - -::: {.tip} - -Nix2 does not have a builtin lockfile mechanism like flakes. As such you must -manually update the URL and hash for your input. This is annoying to deal with, -and most users choose to defer this task to projects such as [npins] or [niv]. -If you are new to NixOS, I encourage you to look into Flakes and see if they fit -your use case. Alternatively, look into the aforementioned projects for more -convenient dependency management mechanisms. - -::: diff --git a/docs/manual/installation/modules/nixos.md b/docs/manual/installation/modules/nixos.md index 946905c1..bcf7472b 100644 --- a/docs/manual/installation/modules/nixos.md +++ b/docs/manual/installation/modules/nixos.md @@ -5,18 +5,9 @@ the NixOS configuration without having to call for the wrapper yourself. It is the recommended way to use **nvf** alongside the home-manager module depending on your needs. -## With Flakes {#sec-nixos-flakes} - -```{=include=} -flakes.md -``` - -### Usage {#sec-nixos-flakes-usage} - -To use **nvf** with flakes, we first need to add the input to our `flake.nix`. +To use it, we first add the input flake. ```nix -# flake.nix { inputs = { # Optional, if you intend to follow nvf's obsidian-nvim input @@ -25,7 +16,7 @@ To use **nvf** with flakes, we first need to add the input to our `flake.nix`. # Required, nvf works best and only directly supports flakes nvf = { - url = "github:NotAShelf/nvf"; + url = "github:notashelf/nvf"; # You can override the input nixpkgs to follow your system's # instance of nixpkgs. This is safe to do as nvf does not depend # on a binary cache. @@ -34,8 +25,6 @@ To use **nvf** with flakes, we first need to add the input to our `flake.nix`. # for example: inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs }; - - # ... }; } ``` @@ -50,7 +39,7 @@ Followed by importing the NixOS module somewhere in your configuration. } ``` -### Example Installation {#sec-example-installation-nixos} +## Example Installation {#sec-example-installation-nixos} ```nix { @@ -75,12 +64,10 @@ Once the module is properly imported by your host, you will be able to use the `programs.nvf` module option anywhere in your configuration in order to configure **nvf**. -```nix -{ +```nix{ programs.nvf = { enable = true; - - # Your settings need to go into the settings attribute set + # your settings need to go into the settings attribute set # most settings are documented in the appendix settings = { vim.viAlias = false; @@ -100,45 +87,3 @@ installation sections of the manual. You may find all available options in the [appendix](https://notashelf.github.io/nvf/options) ::: - -## Without Flakes {#sec-nixos-flakeless} - -As of v0.8, it is possible to install **nvf** on a system if you are not using -flakes. This is possible thanks to the flake-compat project. - -To get started, you must fetch the repository using `builtins.fetchTarball` or a -similar mechanism. - -```nix -# configuration.nix -let - nvf = import (builtins.fetchTarball { - url = "https://github.com/notashelf/nvf/archive/.tar.gz"; - # Optionally, you can add 'sha256' for verification and caching - # sha256 = ""; - }); -in { - imports = [ - # Import the NixOS module from your fetched input - nvf.nixosModules.nvf - ]; - - # Once the module is imported, you may use `programs.nvf` as exposed by the - # NixOS module. - programs.nvf.enable = true; -} -``` - -[npins]: https://github.com/andir/npins -[niv]: https://github.com/nmattia/niv - -::: {.tip} - -Nix2 does not have a builtin lockfile mechanism like flakes. As such you must -manually update the URL and hash for your input. This is annoying to deal with, -and most users choose to defer this task to projects such as [npins] or [niv]. -If you are new to NixOS, I encourage you to look into Flakes and see if they fit -your use case. Alternatively, look into the aforementioned projects for more -convenient dependency management mechanisms. - -::: diff --git a/docs/manual/try-it-out.md b/docs/manual/try-it-out.md index a5d20363..5f326b15 100644 --- a/docs/manual/try-it-out.md +++ b/docs/manual/try-it-out.md @@ -5,20 +5,19 @@ installing it to your machine. Below are the commands you may run to try out different configurations provided by this flake. As of v0.5, two specialized configurations are provided: -- **Nix** (`packages.nix`) - Nix language server + simple utility plugins -- **Maximal** (`packages.maximal`) - Variable language servers + utility and - decorative plugins +- **Nix** - Nix language server + simple utility plugins +- **Maximal** - Variable language servers + utility and decorative plugins You may try out any of the provided configurations using the `nix run` command on a system where Nix is installed. -```sh +```bash $ cachix use nvf # Optional: it'll save you CPU resources and time -$ nix run github:notashelf/nvf#nix # Will run the default minimal configuration +$ nix run github:notashelf/nvf#nix # will run the default minimal configuration ``` -Do keep in mind that this is **susceptible to garbage collection** meaning that -the built outputs will be removed from your Nix store once you garbage collect. +Do keep in mind that this is **susceptible to garbage collection** meaning it +will be removed from your Nix store once you garbage collect. ## Using Prebuilt Configs {#sec-using-prebuilt-configs} @@ -66,7 +65,6 @@ companion or fun plugins. ::: {.warning} Running the maximal config will download _a lot_ of packages as it is -downloading language servers, formatters, and more. If CPU time and bandwidth -are concerns, please use the default package instead. +downloading language servers, formatters, and more. ::: diff --git a/flake.lock b/flake.lock index d33a8f7d..c530031d 100644 --- a/flake.lock +++ b/flake.lock @@ -1,21 +1,5 @@ { "nodes": { - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1751685974, - "narHash": "sha256-NKw96t+BgHIYzHUjkTK95FqYRVKB8DHpVhefWSz/kTw=", - "ref": "refs/heads/main", - "rev": "549f2762aebeff29a2e5ece7a7dc0f955281a1d1", - "revCount": 92, - "type": "git", - "url": "https://git.lix.systems/lix-project/flake-compat.git" - }, - "original": { - "type": "git", - "url": "https://git.lix.systems/lix-project/flake-compat.git" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -89,7 +73,6 @@ }, "root": { "inputs": { - "flake-compat": "flake-compat", "flake-parts": "flake-parts", "flake-utils": "flake-utils", "mnw": "mnw", diff --git a/flake.nix b/flake.nix index 74dcca35..35f69ea6 100644 --- a/flake.nix +++ b/flake.nix @@ -5,9 +5,8 @@ self, ... } @ inputs: let - # Call the extended library with `inputs`. - # inputs is used to get the original standard library, and to pass inputs - # to the plugin autodiscovery function + # call the extended library with `inputs` + # inputs is used to get the original standard library, and to pass inputs to the plugin autodiscovery function lib = import ./lib/stdlib-extended.nix {inherit inputs self;}; in flake-parts.lib.mkFlake { @@ -30,8 +29,6 @@ inherit (lib.nvim) neovimConfiguration; }; - inherit (lib.importJSON ./npins/sources.json) pins; - homeManagerModules = { nvf = import ./flake/modules/home-manager.nix {inherit lib inputs;}; default = self.homeManagerModules.nvf; @@ -53,33 +50,21 @@ '' self.nixosModules.nvf; }; + + inherit (lib.importJSON ./npins/sources.json) pins; }; perSystem = {pkgs, ...}: { - # Provides the default formatter for 'nix fmt', which will format the - # entire tree with Alejandra. The wrapper script is necessary due to - # changes to the behaviour of Nix, which now encourages wrappers for - # tree-wide formatting. - formatter = pkgs.writeShellApplication { - name = "nix3-fmt-wrapper"; + # Provide the default formatter. `nix fmt` in project root + # will format available files with the correct formatter. + # P.S: Please do not format with nixfmt! It messes with many + # syntax elements and results in unreadable code. + formatter = pkgs.alejandra; - runtimeInputs = [ - pkgs.alejandra - pkgs.fd - ]; - - text = '' - # Find Nix files in the tree and format them with Alejandra - fd "$@" -t f -e nix -x alejandra -q '{}' - ''; - }; - - # Provides checks to be built an ran on 'nix flake check'. They can also - # be built individually with 'nix build' as described below. + # Check if codebase is properly formatted. + # This can be initiated with `nix build .#checks..nix-fmt` + # or with `nix flake check` checks = { - # Check if codebase is properly formatted. - # This can be initiated with `nix build .#checks..nix-fmt` - # or with `nix flake check` nix-fmt = pkgs.runCommand "nix-fmt-check" {nativeBuildInputs = [pkgs.alejandra];} '' alejandra --check ${self} < /dev/null | tee $out ''; @@ -87,9 +72,8 @@ }; }; + # Flake inputs inputs = { - systems.url = "github:nix-systems/default"; - ## Basic Inputs nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; @@ -103,10 +87,7 @@ inputs.systems.follows = "systems"; }; - flake-compat = { - url = "git+https://git.lix.systems/lix-project/flake-compat.git"; - flake = false; - }; + systems.url = "github:nix-systems/default"; # Alternate neovim-wrapper mnw.url = "github:Gerg-L/mnw"; diff --git a/modules/plugins/treesitter/treesitter.nix b/modules/plugins/treesitter/treesitter.nix index d761d6b3..80a30a5a 100644 --- a/modules/plugins/treesitter/treesitter.nix +++ b/modules/plugins/treesitter/treesitter.nix @@ -25,7 +25,7 @@ in { type = listOf package; default = []; example = literalExpression '' - with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ + pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ regex kdl ]; @@ -33,7 +33,6 @@ in { description = '' List of treesitter grammars to install. For grammars to be installed properly, you must use grammars from `pkgs.vimPlugins.nvim-treesitter.builtGrammars`. - You can use `pkgs.vimPlugins.nvim-treesitter.allGrammars` to install all grammars. For languages already supported by nvf, you may use {option}`vim.language..treesitter` options, which will automatically add diff --git a/modules/plugins/utility/undotree/undotree.nix b/modules/plugins/utility/undotree/undotree.nix index aac130fe..2483a1ec 100644 --- a/modules/plugins/utility/undotree/undotree.nix +++ b/modules/plugins/utility/undotree/undotree.nix @@ -1,6 +1,8 @@ -{lib, ...}: let +{ lib, ... }: +let inherit (lib.options) mkEnableOption; -in { +in +{ options.vim.undotree = { enable = mkEnableOption "undo history visualizer for Vim [undotree]"; }; diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 8d17121f..00000000 --- a/shell.nix +++ /dev/null @@ -1,7 +0,0 @@ -# Make the behaviour of `nix-shell` consistent with the one of `nix develop` -# by returning the default devShell output from the flake. This is useful when -# I do not want to work with direnv, or simply need backwards compatibility. -{system ? builtins.currentSystem}: let - nvf = import ./.; -in - nvf.devShells.${system}.default