diff --git a/configs/flake-parts/home-manager.nix b/configs/flake-parts/home-manager.nix index 8790eefc..6a5bd0e9 100644 --- a/configs/flake-parts/home-manager.nix +++ b/configs/flake-parts/home-manager.nix @@ -1,5 +1,6 @@ { inputs , lib +, config , defaultNixConf @@ -25,6 +26,10 @@ # Get all of the NUR. inputs.nur.overlays.default + + # We have this since we want to compile those NixVim configuration + # ourselves. + inputs.nixvim-unstable.overlays.default ]; }; homeManagerBranch = "home-manager-unstable"; @@ -33,6 +38,16 @@ inputs.nur.modules.homeManager.default inputs.sops-nix.homeManagerModules.sops inputs.wrapper-manager-fds.homeModules.wrapper-manager + + { + _module.args = { + firstSetupArgs = { + baseNixvimModules = + config.setups.nixvim.configs.fiesta.modules + ++ config.setups.nixvim.sharedModules; + }; + }; + } ]; nixvim = { instance = "fiesta"; diff --git a/configs/home-manager/foo-dogsquared/modules/programs/nixvim/default.nix b/configs/home-manager/foo-dogsquared/modules/programs/nixvim/default.nix index c31352d3..c193cc85 100644 --- a/configs/home-manager/foo-dogsquared/modules/programs/nixvim/default.nix +++ b/configs/home-manager/foo-dogsquared/modules/programs/nixvim/default.nix @@ -1,37 +1,53 @@ # Take note, this already assumes we're using on top of an already existing # NixVim configuration. See the declarative users configuration for more # details. -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, firstSetupArgs, ... }: let userCfg = config.users.foo-dogsquared; cfg = userCfg.programs.nixvim; hmCfg = config; + + createNixvimFlavor = module: + pkgs.nixvim.makeNixvimWithModule { + inherit pkgs; + module.imports = firstSetupArgs.baseNixvimModules ++ [ module ]; + extraSpecialArgs.hmConfig = config; + }; in { options.users.foo-dogsquared.programs.nixvim.enable = lib.mkEnableOption "NixVim setup"; config = lib.mkIf cfg.enable { - programs.nixvim = { ... }: { - imports = - [ - ./colorschemes.nix - ./fuzzy-finding.nix - ./misc.nix - ./note-taking.nix - ] - ++ lib.optionals userCfg.setups.development.enable [ - ./dev.nix - ./lsp.nix - ./dap.nix - ]; - config = { - enable = true; + # Basically, we're creating Neovim flavors with NixVim so no need for it. + # + # Also another reason we're forcibly disabling that it is heavily assumed + # that it is using the Neovim configuration found from the dotfiles repo. + programs.nixvim.enable = lib.mkForce false; - # Inherit all of the schemes. - bahaghari.tinted-theming.schemes = hmCfg.bahaghari.tinted-theming.schemes; - }; + wrapper-manager.packages.neovim-flavors = { + wrappers.nvim-fiesta.arg0 = let + nvimPkg = createNixvimFlavor { + imports = + [ + ./colorschemes.nix + ./fuzzy-finding.nix + ./misc.nix + ./note-taking.nix + ] + ++ lib.optionals userCfg.setups.development.enable [ + ./dev.nix + ./lsp.nix + ./dap.nix + ]; + + config = { + # Inherit all of the schemes. + bahaghari.tinted-theming.schemes = hmCfg.bahaghari.tinted-theming.schemes; + }; + }; + in lib.getExe' nvimPkg "nvim"; }; }; }