diff --git a/flake.nix b/flake.nix index eb7f5904..a9d158a3 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,8 @@ # «https://github.com/nix-systems/nix-systems» systems = import inputs.systems; imports = [ + ./flake/templates + ./flake/apps.nix ./flake/legacyPackages.nix ./flake/overlays.nix diff --git a/flake/templates/default.nix b/flake/templates/default.nix new file mode 100644 index 00000000..58cd7fa7 --- /dev/null +++ b/flake/templates/default.nix @@ -0,0 +1,17 @@ +{ + flake.templates = { + standalone = { + path = ./standalone; + description = "Standalone flake template for nvf"; + welcomeText = '' + Template flake.nix has been created in flake.nix! + + Note that this is a very basic example to bootstrap nvf for you. Please edit your + configuration as described in the nvf manual before using this template. The + configured packages will be ran with 'nix run .' or 'nix run .#neovimConfigured' + + Happy editing! + ''; + }; + }; +} diff --git a/flake/templates/standalone/flake.nix b/flake/templates/standalone/flake.nix new file mode 100644 index 00000000..79617260 --- /dev/null +++ b/flake/templates/standalone/flake.nix @@ -0,0 +1,64 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nvf.url = "github:notashelf/nvf"; + }; + + outputs = { + self, + nixpkgs, + ... + } @ inputs: let + # An abstraction over systems to easily provide the same package + # for multiple systems. This is preferable to abstraction libraries. + forEachSystem = nixpkgs.lib.genAttrs ["x86_64-linux"]; + in { + packages = forEachSystem (system: let + pkgs = inputs.nixpkgs.legacyPackages.${system}; + + # A module to be evaluated via lib.evalModules inside nvf's module system. + # All options supported by nvf will go under config.vim to create the final + # wrapped package. You may also add some new *options* under options.* to + # expand the module system. + configModule = { + # You may browse available options for nvf on the online manual. Please see + # + config.vim = { + theme.enable = true; + + # Language support and automatic configuration of companion plugins. + # Note that enabling, e.g., languages..diagnostics will automatically + # enable top-level options such as enableLSP or enableExtraDiagnostics as + # they are needed. + languages = { + enableLSP = true; + enableFormat = true; + enableTreesitter = true; + enableExtraDiagnostics = true; + + # Nix language and diagnostics. + nix.enable = true; + }; + }; + }; + + # Evaluate any and all modules to create the wrapped Neovim package. + neovimConfigured = inputs.nvf.lib.neovimConfiguration { + inherit pkgs; + + modules = [ + # Configuration module to be imported. You may define multiple modules + # or even import them from other files (e.g., ./modules/lsp.nix) to + # better modularize your configuration. + configModule + ]; + }; + in { + # Packages to be exposed under packages.. Those can accessed + # directly from package outputs in other flakes if this flake is added + # as an input. You may run those packages with 'nix run .#' + default = self.packages.${system}.neovim; + neovimConfigured = neovimConfigured.neovim; + }); + }; +}