Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Install man pages #687

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ be.
Documentation is available on this project's GitHub Pages page:
[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
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.
Expand Down
17 changes: 11 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
# ./plugins/default.nix
];

wrapperArgs = {
inherit modules;
inherit self;
};

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

overlays.default = final: prev: {
nixvim = rec {
makeNixvimWithModule = import ./wrappers/standalone.nix prev modules;
makeNixvimWithModule = import ./wrappers/standalone.nix prev wrapperArgs;
makeNixvim = configuration:
makeNixvimWithModule {
module = {
Expand Down
7 changes: 7 additions & 0 deletions modules/doc.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{lib, ...}: {
options.enableMan = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Install the man pages for nixvim options";
};
}
9 changes: 7 additions & 2 deletions wrappers/darwin.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
modules: {
{
modules,
self,
}: {
pkgs,
config,
lib,
Expand All @@ -24,7 +27,9 @@ in {

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;
Expand Down
11 changes: 9 additions & 2 deletions wrappers/hm.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
modules: {
{
modules,
self,
}: {
pkgs,
config,
lib,
Expand Down Expand Up @@ -32,7 +35,11 @@ in {
config =
mkIf cfg.enable
(mkMerge [
{home.packages = [cfg.finalPackage];}
{
home.packages =
[cfg.finalPackage]
++ (lib.optional cfg.enableMan self.packages.${pkgs.system}.man-docs);
}
(mkIf (!cfg.wrapRc) {
xdg.configFile = files;
})
Expand Down
11 changes: 9 additions & 2 deletions wrappers/nixos.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
modules: {
{
modules,
self,
}: {
pkgs,
config,
lib,
Expand Down Expand Up @@ -33,7 +36,11 @@ in {
config =
mkIf cfg.enable
(mkMerge [
{environment.systemPackages = [cfg.finalPackage];}
{
environment.systemPackages =
[cfg.finalPackage]
++ (lib.optional cfg.enableMan self.packages.${pkgs.system}.man-docs);
}
(mkIf (!cfg.wrapRc) {
environment.etc = files;
environment.variables."VIM" = "/etc/nvim";
Expand Down
11 changes: 9 additions & 2 deletions wrappers/standalone.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
default_pkgs: modules: {
default_pkgs: {
modules,
self,
}: {
pkgs ? default_pkgs,
extraSpecialArgs ? {},
module,
Expand Down Expand Up @@ -27,4 +30,8 @@ default_pkgs: modules: {

config = handleAssertions eval.config;
in
config.finalPackage
config.finalPackage.overrideAttrs (oa: {
paths =
oa.paths
++ (pkgs.lib.optional config.enableMan self.packages.${pkgs.system}.man-docs);
})