mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-01 08:34:41 +02:00
Allow using global config with hm and nixos (#48)
* remove useless nixvim file * reorganize flake outputs * use global config file with home-manager and nixos
This commit is contained in:
parent
931db3e83f
commit
f2a103da30
8 changed files with 146 additions and 355 deletions
23
wrappers/hm.nix
Normal file
23
wrappers/hm.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
modules:
|
||||
{ pkgs, config, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption mkIf mkMerge types;
|
||||
cfg = config.programs.nixvim;
|
||||
in {
|
||||
options = {
|
||||
programs.nixvim = lib.mkOption {
|
||||
type = types.submodule ((modules pkgs) ++ [{
|
||||
options.enable = mkEnableOption "nixvim";
|
||||
}]);
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable
|
||||
(mkMerge [
|
||||
{ home.packages = [ cfg.finalPackage ]; }
|
||||
(mkIf (!cfg.wrapRc) {
|
||||
xdg.configFile."nvim/init.vim".text = cfg.initContent;
|
||||
})
|
||||
]);
|
||||
}
|
24
wrappers/nixos.nix
Normal file
24
wrappers/nixos.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
modules:
|
||||
{ pkgs, config, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption mkMerge mkIf types;
|
||||
cfg = config.programs.nixvim;
|
||||
in {
|
||||
options = {
|
||||
programs.nixvim = lib.mkOption {
|
||||
type = types.submodule ((modules pkgs) ++ [{
|
||||
options.enable = mkEnableOption "nixvim";
|
||||
}]);
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable
|
||||
(mkMerge [
|
||||
{ environment.systemPackages = [ cfg.finalPackage ]; }
|
||||
(mkIf (!cfg.wrapRc) {
|
||||
environment.etc."nvim/sysinit.vim".text = cfg.initContent;
|
||||
environment.variables."VIM" = "/etc/nvim";
|
||||
})
|
||||
]);
|
||||
}
|
13
wrappers/standalone.nix
Normal file
13
wrappers/standalone.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
pkgs: modules: configuration:
|
||||
|
||||
let
|
||||
|
||||
inherit (pkgs) lib;
|
||||
|
||||
wrap = { wrapRc = true; };
|
||||
|
||||
eval = lib.evalModules {
|
||||
modules = modules ++ [ { config = configuration; } wrap ];
|
||||
};
|
||||
|
||||
in eval.config.finalPackage
|
Loading…
Add table
Add a link
Reference in a new issue