mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
templates: add experimental-flake-parts template
This template uses the lower-level `evalNixvim` function to work directly with nixvim configurations, instead of the prior idiom of using `makeNixvim` to produce nixvim packages. Additionally, the template is build on flake.parts, and demonstrates using our recently added flakeModules.
This commit is contained in:
parent
e3938e9464
commit
342161bf52
5 changed files with 99 additions and 0 deletions
|
@ -5,6 +5,10 @@
|
|||
path = ../templates/simple;
|
||||
description = "A simple nix flake template for getting started with nixvim";
|
||||
};
|
||||
new = {
|
||||
path = ../templates/experimental-flake-parts;
|
||||
description = "An experimental flake template for configuring nixvim using evalNixvim and flake.parts";
|
||||
};
|
||||
};
|
||||
|
||||
# The following adds the template flake's checks to the main (current) flake's checks.
|
||||
|
|
31
templates/experimental-flake-parts/README.md
Normal file
31
templates/experimental-flake-parts/README.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
# New Nixvim template
|
||||
|
||||
This template gives you a good starting point for configuring nixvim as a standalone module configuration.
|
||||
|
||||
## Configuring
|
||||
|
||||
To start configuring, just add or modify the module files in `./config`.
|
||||
If you add new modules, remember to import them in [`./config/default.nix`](./config/default.nix).
|
||||
|
||||
## Using your vim configuration
|
||||
|
||||
To use your configuration simply run the following command
|
||||
|
||||
```
|
||||
nix run
|
||||
```
|
||||
|
||||
## Configurations and packages
|
||||
|
||||
Your nixvim configuration is created using `evalNixvim`.
|
||||
This is outputted as the `nixvimConfigurations.<system>.default` flake output.
|
||||
|
||||
You can access your configuration's package outputs `<configuration>.config.build.package`.
|
||||
This is exported as the flake output `packages.<system>.default`.
|
||||
This package can be run using `nix run`.
|
||||
|
||||
A test is also available as `<configuration>.config.build.test`.
|
||||
This is exported as the flake output `checks.<system>.default`.
|
||||
This test can be run using `nix flake check`.
|
||||
|
||||
<!-- TODO: figure out how to _wrap_ an existing configuration as a nixos/hm module -->
|
6
templates/experimental-flake-parts/config/bufferline.nix
Normal file
6
templates/experimental-flake-parts/config/bufferline.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
plugins = {
|
||||
bufferline.enable = true;
|
||||
web-devicons.enable = true;
|
||||
};
|
||||
}
|
4
templates/experimental-flake-parts/config/default.nix
Normal file
4
templates/experimental-flake-parts/config/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
# Import all your configuration modules here
|
||||
imports = [ ./bufferline.nix ];
|
||||
}
|
54
templates/experimental-flake-parts/flake.nix
Normal file
54
templates/experimental-flake-parts/flake.nix
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
description = "A nixvim configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixvim.url = "github:nix-community/nixvim";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self, flake-parts, ... }@inputs:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
|
||||
imports = [
|
||||
# Import nixvim's flake-parts module;
|
||||
# Adds `flake.nixvimModules` and `perSystem.nixvimConfigurations`
|
||||
inputs.nixvim.flakeModules.default
|
||||
];
|
||||
|
||||
nixvim = {
|
||||
# Automatically install corresponding packages for each nixvimConfiguration
|
||||
# Lets you run `nix run .#<name>`, or simply `nix run` if you have a default
|
||||
packages.enable = true;
|
||||
# Automatically install checks for each nixvimConfiguration
|
||||
# Run `nix flake check` to verify that your config is not broken
|
||||
checks.enable = true;
|
||||
};
|
||||
|
||||
# You can define your reusable Nixvim modules here
|
||||
flake.nixvimModules = {
|
||||
default = ./config;
|
||||
};
|
||||
|
||||
perSystem =
|
||||
{ system, ... }:
|
||||
{
|
||||
# You can define actual Nixvim configurations here
|
||||
nixvimConfigurations = {
|
||||
default = inputs.nixvim.lib.evalNixvim {
|
||||
inherit system;
|
||||
modules = [
|
||||
self.nixvimModules.default
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue