docs: Allow to install man pages (#687)

This commit is contained in:
traxys 2023-11-06 16:26:23 +01:00 committed by GitHub
parent e45be89f12
commit 541b694873
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 55 additions and 14 deletions

View file

@ -218,6 +218,9 @@ be.
Documentation is available on this project's GitHub Pages page: Documentation is available on this project's GitHub Pages page:
[https://nix-community.github.io/nixvim](https://nix-community.github.io/nixvim) [https://nix-community.github.io/nixvim](https://nix-community.github.io/nixvim)
If the option `enableMan` is set to `true` (by default it is), man pages will also
be installed containing the same informations, they can be viewed with `man nixvim`.
## Plugins ## Plugins
After you have installed NixVim, you will no doubt want to enable some plugins. After you have installed NixVim, you will no doubt want to enable some plugins.
Plugins are based on a modules system, similarly to NixOS and Home Manager. Plugins are based on a modules system, similarly to NixOS and Home Manager.

View file

@ -47,6 +47,11 @@
# ./plugins/default.nix # ./plugins/default.nix
]; ];
wrapperArgs = {
inherit modules;
inherit self;
};
flakeOutput = flakeOutput =
flake-utils.lib.eachDefaultSystem flake-utils.lib.eachDefaultSystem
(system: let (system: let
@ -66,7 +71,7 @@
# As we test as many things as possible, we need to allow unfree sources by generating # As we test as many things as possible, we need to allow unfree sources by generating
# a separate `makeNixvim` module (with pkgs-unfree). # a separate `makeNixvim` module (with pkgs-unfree).
makeNixvim = let makeNixvim = let
makeNixvimWithModuleUnfree = import ./wrappers/standalone.nix pkgs-unfree modules; makeNixvimWithModuleUnfree = import ./wrappers/standalone.nix pkgs-unfree wrapperArgs;
in in
configuration: configuration:
makeNixvimWithModuleUnfree { makeNixvimWithModuleUnfree {
@ -108,7 +113,7 @@
modules = modules pkgs; modules = modules pkgs;
}); });
legacyPackages = rec { legacyPackages = rec {
makeNixvimWithModule = import ./wrappers/standalone.nix pkgs modules; makeNixvimWithModule = import ./wrappers/standalone.nix pkgs wrapperArgs;
makeNixvim = configuration: makeNixvim = configuration:
makeNixvimWithModule { makeNixvimWithModule {
module = { module = {
@ -126,14 +131,14 @@
in in
flakeOutput flakeOutput
// { // {
nixosModules.nixvim = import ./wrappers/nixos.nix modules; nixosModules.nixvim = import ./wrappers/nixos.nix wrapperArgs;
homeManagerModules.nixvim = import ./wrappers/hm.nix modules; homeManagerModules.nixvim = import ./wrappers/hm.nix wrapperArgs;
nixDarwinModules.nixvim = import ./wrappers/darwin.nix modules; nixDarwinModules.nixvim = import ./wrappers/darwin.nix wrapperArgs;
rawModules.nixvim = nixvimModules; rawModules.nixvim = nixvimModules;
overlays.default = final: prev: { overlays.default = final: prev: {
nixvim = rec { nixvim = rec {
makeNixvimWithModule = import ./wrappers/standalone.nix prev modules; makeNixvimWithModule = import ./wrappers/standalone.nix prev wrapperArgs;
makeNixvim = configuration: makeNixvim = configuration:
makeNixvimWithModule { makeNixvimWithModule {
module = { module = {

7
modules/doc.nix Normal file
View file

@ -0,0 +1,7 @@
{lib, ...}: {
options.enableMan = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Install the man pages for nixvim options";
};
}

View file

@ -1,4 +1,7 @@
modules: { {
modules,
self,
}: {
pkgs, pkgs,
config, config,
lib, lib,
@ -24,7 +27,9 @@ in {
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (mkMerge [
{ {
environment.systemPackages = [cfg.finalPackage]; environment.systemPackages =
[cfg.finalPackage]
++ (lib.optional cfg.enableMan self.packages.${pkgs.system}.man-docs);
} }
{ {
inherit (cfg) warnings assertions; inherit (cfg) warnings assertions;

View file

@ -1,4 +1,7 @@
modules: { {
modules,
self,
}: {
pkgs, pkgs,
config, config,
lib, lib,
@ -32,7 +35,11 @@ in {
config = config =
mkIf cfg.enable mkIf cfg.enable
(mkMerge [ (mkMerge [
{home.packages = [cfg.finalPackage];} {
home.packages =
[cfg.finalPackage]
++ (lib.optional cfg.enableMan self.packages.${pkgs.system}.man-docs);
}
(mkIf (!cfg.wrapRc) { (mkIf (!cfg.wrapRc) {
xdg.configFile = files; xdg.configFile = files;
}) })

View file

@ -1,4 +1,7 @@
modules: { {
modules,
self,
}: {
pkgs, pkgs,
config, config,
lib, lib,
@ -33,7 +36,11 @@ in {
config = config =
mkIf cfg.enable mkIf cfg.enable
(mkMerge [ (mkMerge [
{environment.systemPackages = [cfg.finalPackage];} {
environment.systemPackages =
[cfg.finalPackage]
++ (lib.optional cfg.enableMan self.packages.${pkgs.system}.man-docs);
}
(mkIf (!cfg.wrapRc) { (mkIf (!cfg.wrapRc) {
environment.etc = files; environment.etc = files;
environment.variables."VIM" = "/etc/nvim"; environment.variables."VIM" = "/etc/nvim";

View file

@ -1,4 +1,7 @@
default_pkgs: modules: { default_pkgs: {
modules,
self,
}: {
pkgs ? default_pkgs, pkgs ? default_pkgs,
extraSpecialArgs ? {}, extraSpecialArgs ? {},
module, module,
@ -27,4 +30,8 @@ default_pkgs: modules: {
config = handleAssertions eval.config; config = handleAssertions eval.config;
in in
config.finalPackage config.finalPackage.overrideAttrs (oa: {
paths =
oa.paths
++ (pkgs.lib.optional config.enableMan self.packages.${pkgs.system}.man-docs);
})