mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
flake/modules: add options to set default editor to nixos and home-manager modules
This commit is contained in:
parent
4d8dcc7e49
commit
6d681c2c08
2 changed files with 65 additions and 15 deletions
|
@ -6,9 +6,10 @@ packages: inputs: {
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) maintainers;
|
inherit (lib) maintainers;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.lists) optionals;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) attrsOf anything;
|
inherit (lib.types) attrsOf anything bool;
|
||||||
|
|
||||||
cfg = config.programs.neovim-flake;
|
cfg = config.programs.neovim-flake;
|
||||||
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
||||||
|
@ -21,7 +22,24 @@ in {
|
||||||
meta.maintainers = with maintainers; [NotAShelf];
|
meta.maintainers = with maintainers; [NotAShelf];
|
||||||
|
|
||||||
options.programs.neovim-flake = {
|
options.programs.neovim-flake = {
|
||||||
enable = mkEnableOption "neovim-flake, the extensible neovim-wrapper";
|
enable = mkEnableOption "neovim-flake, the extensible neovim configuration wrapper";
|
||||||
|
|
||||||
|
enableManpages = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to enable manpages for neovim-flake.";
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultEditor = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to set `neovim-flake` as the default editor.
|
||||||
|
|
||||||
|
This will set the `EDITOR` environment variable as `nvim`
|
||||||
|
if set to true.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
finalPackage = mkOption {
|
finalPackage = mkOption {
|
||||||
type = anything;
|
type = anything;
|
||||||
|
@ -56,9 +74,16 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable mkMerge [
|
||||||
home.packages = [cfg.finalPackage];
|
{
|
||||||
|
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
|
||||||
|
|
||||||
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
|
home = {
|
||||||
};
|
sessionVariables.EDITOR = mkIf cfg.defaultEditor (lib.mkOverride 900 "nvim");
|
||||||
|
packages =
|
||||||
|
[cfg.finalPackage]
|
||||||
|
++ optionals cfg.enableManpages packages.${pkgs.stdenv.system}.docs-manpages;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Home Manager module
|
# NixOS module
|
||||||
packages: inputs: {
|
packages: inputs: {
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
@ -6,9 +6,10 @@ packages: inputs: {
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) maintainers;
|
inherit (lib) maintainers;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.lists) optionals;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) attrsOf anything;
|
inherit (lib.types) attrsOf anything bool;
|
||||||
|
|
||||||
cfg = config.programs.neovim-flake;
|
cfg = config.programs.neovim-flake;
|
||||||
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
||||||
|
@ -21,7 +22,24 @@ in {
|
||||||
meta.maintainers = with maintainers; [NotAShelf];
|
meta.maintainers = with maintainers; [NotAShelf];
|
||||||
|
|
||||||
options.programs.neovim-flake = {
|
options.programs.neovim-flake = {
|
||||||
enable = mkEnableOption "neovim-flake, the extensible neovim-wrapper";
|
enable = mkEnableOption "neovim-flake, the extensible neovim configuration wrapper";
|
||||||
|
|
||||||
|
enableManpages = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to enable manpages for neovim-flake.";
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultEditor = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to set `neovim-flake` as the default editor.
|
||||||
|
|
||||||
|
This will set the `EDITOR` environment variable as `nvim`
|
||||||
|
if set to true.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
finalPackage = mkOption {
|
finalPackage = mkOption {
|
||||||
type = anything;
|
type = anything;
|
||||||
|
@ -56,9 +74,16 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable mkMerge [
|
||||||
environment.systemPackages = [cfg.finalPackage];
|
{
|
||||||
|
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
|
||||||
|
|
||||||
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
|
environment = {
|
||||||
};
|
variables.EDITOR = mkIf cfg.defaultEditor (lib.mkOverride 900 "nvim");
|
||||||
|
systemPackages =
|
||||||
|
[cfg.finalPackage]
|
||||||
|
++ optionals cfg.enableManpages packages.${pkgs.stdenv.system}.docs-manpages;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue