Try to use home-manager

This commit is contained in:
Pedro Alves 2021-01-25 17:20:29 +00:00
parent 32728e5ea9
commit 62785421a4
2 changed files with 70 additions and 55 deletions

View file

@ -9,7 +9,8 @@
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
nixosConfigurations.container = nixpkgs.lib.nixosSystem {

View file

@ -1,3 +1,4 @@
homeManager:
{ pkgs, lib, config, ... }:
with lib;
let
@ -191,22 +192,6 @@ in
+ 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 = {
customRC = ''
lua <<EOF
@ -260,8 +245,37 @@ in
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;
} else {
programs.nixvim.extraConfigLua = extraConfigLua;
programs.neovim = {
enable = true;
package = cfg.package;
extraPackages = cfg.extraPackages;
configure = configure;
};
});
}