mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
This represents a major rearchitecture for nixvim, so I'm leaving this up to track the progress for now, and to serve as a reference for any breaking changes during transition. The main change is, of course, being able to use nixvim standalone. To do this, you should use the new build function, which takes in two arguments: the system architecture (e.g. x86_64-linux) and the configuration. For the new configuration, do not use the programs.nixvim. prefix. For module development, the main change is that you should no longer prefix your modules with programs.nixvim..
83 lines
2.5 KiB
Nix
83 lines
2.5 KiB
Nix
{
|
|
description = "A neovim configuration system for NixOS";
|
|
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
inputs.nmdSrc.url = "gitlab:rycee/nmd";
|
|
inputs.nmdSrc.flake = false;
|
|
|
|
# TODO: Use flake-utils to support all architectures
|
|
outputs = { self, nixpkgs, nmdSrc, 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;
|
|
lib = pkgs.lib;
|
|
helpers = import ./plugins/helpers.nix { lib = pkgs.lib; };
|
|
};
|
|
};
|
|
})
|
|
|
|
./plugins/default.nix
|
|
];
|
|
|
|
nixvimOption = pkgs: mkOption {
|
|
type = types.submodule ((modules pkgs) ++ [{
|
|
options.enable = mkEnableOption "Enable nixvim";
|
|
}]);
|
|
};
|
|
|
|
build = pkgs:
|
|
configuration:
|
|
let
|
|
eval = evalModules {
|
|
modules = modules pkgs ++ [ configuration ];
|
|
};
|
|
in
|
|
eval.config.output;
|
|
|
|
flakeOutput =
|
|
flake-utils.lib.eachDefaultSystem
|
|
(system: rec {
|
|
packages.docs = import ./docs {
|
|
pkgs = import nixpkgs { inherit system; };
|
|
lib = nixpkgs.lib;
|
|
nixvimModules = nixvimModules;
|
|
inherit nmdSrc;
|
|
};
|
|
|
|
nixosModules.nixvim = { pkgs, config, lib, ... }: {
|
|
options.programs.nixvim = nixvimOption pkgs;
|
|
config = mkIf config.programs.nixvim.enable {
|
|
environment.systemPackages = [
|
|
config.programs.nixvim.output
|
|
];
|
|
};
|
|
};
|
|
|
|
homeManagerModules.nixvim = { pkgs, config, lib, ... }: {
|
|
options.programs.nixvim = nixvimOption pkgs;
|
|
config = mkIf config.programs.nixvim.enable {
|
|
home.packages = [
|
|
config.programs.nixvim.output
|
|
];
|
|
};
|
|
};
|
|
});
|
|
in
|
|
flakeOutput // {
|
|
inherit build;
|
|
# TODO: Stuff for home-manager and nixos modules backwards compat, keeping the architecture as x86_64 if none is specified...
|
|
homeManagerModules.nixvim = flakeOutput.homeManagerModules.x86_64-linux.nixvim;
|
|
nixosModules.nixvim = flakeOutput.nixosModules.x86_64-linux.nixvim;
|
|
};
|
|
}
|