nix-community.nixvim/flake.nix
traxys 660c9319e1
wrappers: Extend and document the makeNixvim function (#86)
* wrappers: Allow to customize the nixpkgs used for nixvim

This allows to pass overlays and other such modifications of nixpkgs.

* wrappers: Allow to pass a custom module to nixvim

This is useful to be able to take full advantage of the Nix module
system, with `imports` and `options`.

* README: Update the documentation on the standalone usage

The following information were out of date or incomplete:

- The `build` function has be changed to the `makeNixvim` function.
- `makeNixvimWithModule` has been introduced in order to allow more
customization.
- Added a full example using nixvim in a standalone flake
2022-12-29 17:51:57 +00:00

57 lines
1.7 KiB
Nix

{
description = "A neovim configuration system for NixOS";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.beautysh.url = "github:lovesegfault/beautysh";
inputs.beautysh.inputs.nixpkgs.follows = "nixpkgs";
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
with nixpkgs.lib;
with builtins;
let
# TODO: Support nesting
nixvimModules = map (f: ./modules + "/${f}") (attrNames (builtins.readDir ./modules));
modules = pkgs: nixvimModules ++ [
(rec {
_file = ./flake.nix;
key = _file;
config = {
_module.args = {
pkgs = mkForce pkgs;
inherit (pkgs) lib;
helpers = import ./plugins/helpers.nix { inherit (pkgs) lib; };
inputs = inputs;
};
};
})
# ./plugins/default.nix
];
flakeOutput =
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; };
in
{
packages.docs = pkgs.callPackage (import ./docs.nix) {
modules = nixvimModules;
};
legacyPackages = rec {
makeNixvimWithModule = import ./wrappers/standalone.nix pkgs modules;
makeNixvim = configuration: makeNixvimWithModule {
module = {
config = configuration;
};
};
};
});
in
flakeOutput // {
nixosModules.nixvim = import ./wrappers/nixos.nix modules;
homeManagerModules.nixvim = import ./wrappers/hm.nix modules;
};
}