mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-28 13:58:41 +02:00
wrappers: removed code duplication
This commit is contained in:
parent
78e7d229a1
commit
e0ed2eabf9
4 changed files with 25 additions and 30 deletions
16
wrappers/_shared.nix
Normal file
16
wrappers/_shared.nix
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
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; };
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
modules:
|
modules:
|
||||||
{ pkgs, config, lib, ... }:
|
{ pkgs, config, lib, ... }@args:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
|
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
|
||||||
|
shared = import ./_shared.nix args;
|
||||||
cfg = config.programs.nixvim;
|
cfg = config.programs.nixvim;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -13,15 +14,7 @@ in
|
||||||
config.wrapRc = mkForce true;
|
config.wrapRc = mkForce true;
|
||||||
}]);
|
}]);
|
||||||
};
|
};
|
||||||
nixvim.helpers = mkOption {
|
nixvim.helpers = shared.helpers;
|
||||||
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; };
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
modules:
|
modules:
|
||||||
{ pkgs, config, lib, ... }:
|
{ pkgs, config, lib, ... }@args:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
||||||
|
shared = import ./_shared.nix args;
|
||||||
cfg = config.programs.nixvim;
|
cfg = config.programs.nixvim;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -12,15 +13,7 @@ in
|
||||||
options.enable = mkEnableOption "nixvim";
|
options.enable = mkEnableOption "nixvim";
|
||||||
}]);
|
}]);
|
||||||
};
|
};
|
||||||
nixvim.helpers = mkOption {
|
nixvim.helpers = shared.helpers;
|
||||||
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; };
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable
|
config = mkIf cfg.enable
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
modules:
|
modules:
|
||||||
{ pkgs, config, lib, ... }:
|
{ pkgs, config, lib, ... }@args:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
||||||
|
shared = import ./_shared.nix args;
|
||||||
cfg = config.programs.nixvim;
|
cfg = config.programs.nixvim;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -12,15 +13,7 @@ in
|
||||||
options.enable = mkEnableOption "nixvim";
|
options.enable = mkEnableOption "nixvim";
|
||||||
}]);
|
}]);
|
||||||
};
|
};
|
||||||
nixvim.helpers = mkOption {
|
nixvim.helpers = shared.helpers;
|
||||||
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; };
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable
|
config = mkIf cfg.enable
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue