2022-10-17 15:08:17 +02:00
|
|
|
modules:
|
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
|
|
|
|
let
|
2022-11-07 23:12:40 +08:00
|
|
|
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
2022-10-17 15:08:17 +02:00
|
|
|
cfg = config.programs.nixvim;
|
2022-11-07 23:12:40 +08:00
|
|
|
in
|
|
|
|
{
|
2022-10-17 15:08:17 +02:00
|
|
|
options = {
|
2022-11-07 23:12:40 +08:00
|
|
|
programs.nixvim = mkOption {
|
2022-10-17 15:08:17 +02:00
|
|
|
type = types.submodule ((modules pkgs) ++ [{
|
|
|
|
options.enable = mkEnableOption "nixvim";
|
|
|
|
}]);
|
|
|
|
};
|
2022-11-07 23:12:40 +08:00
|
|
|
nixvim.helpers = 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-10-17 15:08:17 +02:00
|
|
|
};
|
|
|
|
|
2022-11-07 23:12:40 +08:00
|
|
|
config = mkIf cfg.enable
|
2022-10-17 15:08:17 +02:00
|
|
|
(mkMerge [
|
|
|
|
{ home.packages = [ cfg.finalPackage ]; }
|
|
|
|
(mkIf (!cfg.wrapRc) {
|
2022-11-07 10:59:10 -05:00
|
|
|
xdg.configFile."nvim/init.lua".text = cfg.initContent;
|
2022-10-17 15:08:17 +02:00
|
|
|
})
|
|
|
|
]);
|
|
|
|
}
|