mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
expose helpers to config.nixvim.helpers (#51)
This commit is contained in:
commit
928e7f2673
11 changed files with 244 additions and 405 deletions
74
flake.nix
74
flake.nix
|
@ -6,7 +6,6 @@
|
|||
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;
|
||||
|
@ -30,66 +29,25 @@
|
|||
./plugins/default.nix
|
||||
];
|
||||
|
||||
nixvimOption = pkgs: mkOption {
|
||||
type = types.submodule ((modules pkgs) ++ [{
|
||||
options.enable = mkEnableOption "Enable nixvim";
|
||||
}]);
|
||||
};
|
||||
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; };
|
||||
};
|
||||
|
||||
build = pkgs:
|
||||
configuration:
|
||||
let
|
||||
eval = evalModules {
|
||||
modules = modules pkgs ++ [{ config = configuration; }];
|
||||
};
|
||||
in
|
||||
eval.config.output;
|
||||
|
||||
flakeOutput =
|
||||
flake-utils.lib.eachDefaultSystem
|
||||
(system: rec {
|
||||
packages.docs = import ./docs {
|
||||
(system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
lib = nixpkgs.lib;
|
||||
nixvimModules = nixvimModules;
|
||||
inherit nmdSrc;
|
||||
};
|
||||
});
|
||||
in
|
||||
{
|
||||
packages.docs = import ./docs {
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
lib = nixpkgs.lib;
|
||||
nixvimModules = nixvimModules;
|
||||
inherit nmdSrc;
|
||||
};
|
||||
|
||||
legacyPackages.makeNixvim = import ./wrappers/standalone.nix pkgs (modules pkgs);
|
||||
});
|
||||
in
|
||||
flakeOutput // rec {
|
||||
inherit build;
|
||||
|
||||
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
|
||||
];
|
||||
};
|
||||
};
|
||||
flakeOutput // {
|
||||
nixosModules.nixvim = import ./wrappers/nixos.nix modules;
|
||||
homeManagerModules.nixvim = import ./wrappers/hm.nix modules;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue