2020-12-30 01:05:51 +00:00
|
|
|
{
|
|
|
|
description = "A neovim configuration system for NixOS";
|
|
|
|
|
2022-09-18 11:19:23 +01:00
|
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
2020-12-30 01:05:51 +00:00
|
|
|
|
2022-01-10 19:50:13 +00:00
|
|
|
inputs.nmdSrc.url = "gitlab:rycee/nmd";
|
|
|
|
inputs.nmdSrc.flake = false;
|
|
|
|
|
2022-09-18 11:19:23 +01:00
|
|
|
# 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;
|
2022-10-16 06:06:48 +08:00
|
|
|
inherit (pkgs) lib;
|
|
|
|
helpers = import ./plugins/helpers.nix { inherit (pkgs) lib; };
|
2021-01-05 11:26:49 +00:00
|
|
|
};
|
2022-09-18 11:19:23 +01:00
|
|
|
};
|
|
|
|
})
|
2021-01-07 16:06:39 +00:00
|
|
|
|
2022-09-18 11:19:23 +01:00
|
|
|
./plugins/default.nix
|
|
|
|
];
|
2021-02-01 15:54:53 +00:00
|
|
|
|
2022-09-18 11:19:23 +01:00
|
|
|
nixvimOption = pkgs: mkOption {
|
|
|
|
type = types.submodule ((modules pkgs) ++ [{
|
|
|
|
options.enable = mkEnableOption "Enable nixvim";
|
|
|
|
}]);
|
|
|
|
};
|
2022-10-16 06:06:48 +08:00
|
|
|
helperOption = pkgs: mkOption {
|
|
|
|
type = mkOptionType {
|
|
|
|
name = "helpers";
|
|
|
|
description = "Helpers that can be used when writing nixvim configs";
|
|
|
|
check = builtins.isAttrs;
|
|
|
|
};
|
|
|
|
description = "Use this option to access the helpers";
|
|
|
|
default = import ./plugins/helpers.nix { inherit (pkgs) lib; };
|
|
|
|
};
|
2022-09-18 11:19:23 +01:00
|
|
|
|
|
|
|
build = pkgs:
|
|
|
|
configuration:
|
|
|
|
let
|
|
|
|
eval = evalModules {
|
2022-10-03 15:21:28 +01:00
|
|
|
modules = modules pkgs ++ [{ config = configuration; }];
|
2022-09-18 11:19:23 +01:00
|
|
|
};
|
|
|
|
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;
|
2021-02-01 15:54:53 +00:00
|
|
|
};
|
2022-09-18 11:19:23 +01:00
|
|
|
});
|
|
|
|
in
|
2022-10-16 06:06:48 +08:00
|
|
|
flakeOutput // rec {
|
2022-09-18 11:19:23 +01:00
|
|
|
inherit build;
|
2022-10-16 06:06:48 +08:00
|
|
|
|
|
|
|
nixosModules.nixvim = { pkgs, config, lib, ... }: {
|
|
|
|
options = {
|
|
|
|
programs.nixvim = nixvimOption pkgs;
|
|
|
|
nixvim.helpers = helperOption pkgs;
|
|
|
|
};
|
|
|
|
config = mkIf config.programs.nixvim.enable {
|
|
|
|
environment.systemPackages = [
|
|
|
|
config.programs.nixvim.output
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
homeManagerModules.nixvim = { pkgs, config, lib, ... }: {
|
|
|
|
options = {
|
|
|
|
programs.nixvim = nixvimOption pkgs;
|
|
|
|
nixvim.helpers = helperOption pkgs;
|
|
|
|
};
|
|
|
|
config = mkIf config.programs.nixvim.enable {
|
|
|
|
home.packages = [
|
|
|
|
config.programs.nixvim.output
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2020-12-30 01:05:51 +00:00
|
|
|
};
|
|
|
|
}
|