mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
Try to use home-manager
This commit is contained in:
parent
32728e5ea9
commit
62785421a4
2 changed files with 70 additions and 55 deletions
|
@ -9,7 +9,8 @@
|
||||||
inputs.neovim-nightly.overlay
|
inputs.neovim-nightly.overlay
|
||||||
];
|
];
|
||||||
|
|
||||||
nixosModules.nixvim = import ./nixvim.nix;
|
nixosModules.nixvim = import ./nixvim.nix false;
|
||||||
|
homeManagerModules.nixvim = import ./nixvim.nix true;
|
||||||
|
|
||||||
# This is a simple container for testing
|
# This is a simple container for testing
|
||||||
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
|
||||||
|
|
46
nixvim.nix
46
nixvim.nix
|
@ -1,3 +1,4 @@
|
||||||
|
homeManager:
|
||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
|
@ -191,22 +192,6 @@ in
|
||||||
+ extraWrapperArgs;
|
+ extraWrapperArgs;
|
||||||
});
|
});
|
||||||
|
|
||||||
mappings =
|
|
||||||
(helpers.genMaps "" cfg.maps.normalVisualOp) ++
|
|
||||||
(helpers.genMaps "n" cfg.maps.normal) ++
|
|
||||||
(helpers.genMaps "i" cfg.maps.insert) ++
|
|
||||||
(helpers.genMaps "v" cfg.maps.visual) ++
|
|
||||||
(helpers.genMaps "x" cfg.maps.visualOnly) ++
|
|
||||||
(helpers.genMaps "s" cfg.maps.select) ++
|
|
||||||
(helpers.genMaps "t" cfg.maps.terminal) ++
|
|
||||||
(helpers.genMaps "o" cfg.maps.operator) ++
|
|
||||||
(helpers.genMaps "l" cfg.maps.lang) ++
|
|
||||||
(helpers.genMaps "!" cfg.maps.insertCommand) ++
|
|
||||||
(helpers.genMaps "c" cfg.maps.command);
|
|
||||||
|
|
||||||
in mkIf cfg.enable {
|
|
||||||
environment.systemPackages = [ wrappedNeovim ];
|
|
||||||
programs.nixvim = {
|
|
||||||
configure = {
|
configure = {
|
||||||
customRC = ''
|
customRC = ''
|
||||||
lua <<EOF
|
lua <<EOF
|
||||||
|
@ -260,8 +245,37 @@ in
|
||||||
end
|
end
|
||||||
-- }}}
|
-- }}}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
mappings =
|
||||||
|
(helpers.genMaps "" cfg.maps.normalVisualOp) ++
|
||||||
|
(helpers.genMaps "n" cfg.maps.normal) ++
|
||||||
|
(helpers.genMaps "i" cfg.maps.insert) ++
|
||||||
|
(helpers.genMaps "v" cfg.maps.visual) ++
|
||||||
|
(helpers.genMaps "x" cfg.maps.visualOnly) ++
|
||||||
|
(helpers.genMaps "s" cfg.maps.select) ++
|
||||||
|
(helpers.genMaps "t" cfg.maps.terminal) ++
|
||||||
|
(helpers.genMaps "o" cfg.maps.operator) ++
|
||||||
|
(helpers.genMaps "l" cfg.maps.lang) ++
|
||||||
|
(helpers.genMaps "!" cfg.maps.insertCommand) ++
|
||||||
|
(helpers.genMaps "c" cfg.maps.command);
|
||||||
|
|
||||||
|
in mkIf cfg.enable (if (!homeManager) then {
|
||||||
|
environment.systemPackages = [ wrappedNeovim ];
|
||||||
|
programs.nixvim = {
|
||||||
|
configure = configure;
|
||||||
|
|
||||||
|
extraConfigLua = extraConfigLua;
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.etc."xdg/nvim/sysinit.vim".text = neovimConfig.neovimRcContent;
|
environment.etc."xdg/nvim/sysinit.vim".text = neovimConfig.neovimRcContent;
|
||||||
|
} else {
|
||||||
|
programs.nixvim.extraConfigLua = extraConfigLua;
|
||||||
|
programs.neovim = {
|
||||||
|
enable = true;
|
||||||
|
package = cfg.package;
|
||||||
|
extraPackages = cfg.extraPackages;
|
||||||
|
|
||||||
|
configure = configure;
|
||||||
};
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue