flake: add standalone template

This commit is contained in:
raf 2025-02-03 14:47:35 +03:00
parent a26e93c410
commit 199babe62c
No known key found for this signature in database
GPG key ID: EED98D11B85A2819
3 changed files with 83 additions and 0 deletions

View file

@ -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

View file

@ -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!
'';
};
};
}

View file

@ -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
# <https://notashelf.github.io/nvf/options.html>
config.vim = {
theme.enable = true;
# Language support and automatic configuration of companion plugins.
# Note that enabling, e.g., languages.<lang>.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.<system>. 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 .#<package>'
default = self.packages.${system}.neovim;
neovimConfigured = neovimConfigured.neovim;
});
};
}