-
-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help Configuring NixVim Config Files Path #2477
Comments
We could (and probably should) add an option to allow configuring the files prefix, however you'll only be able to create one nixvim configuration if you're using a wrapper module to configure nixvim. Maybe we should consider having a way to have multiple nixvim's configured per module eval... Perhaps we could setup something similar to our All that said, this exact scenario is really what the "standalone" nixvim is intended to solve; although even that has some limitations. The standalone build will not install the config files anywhere (other than the nix store, of course), and will instead tell the The main limitation for standalone builds is that we don't currently offer a sensible way to configure the It would be possible to do something like this though, but we should probably consider better ways to solve all of these scenarios with new nixvim options.
|
Also, we have the wrapRc option that prevents the config file to end up in |
@MattSturgeon @GaetanLepage thank you for your responses. Yes, overall I think it would be great for nixvim itself to have the ability to define multiple profiles and perhaps even manage multiple nvim installs. In the most basic case, I just want to move the configs to another directory. Would it be possible to use an In the meantime I'm interested in helping define the option that would set the As for the bigger idea on letting |
As for the |
@MattSturgeon @GaetanLepage, I have worked on a home-manager module that allows for multiple concurrent profiles. I think I have done just about everything right on my end with regards to creating a multi profile option set for the module, which would reside at The module that is added to the home-manager modules list in the flake { self, inputs, config, pkgs, lib, nixvimFactory, ... }: # assume nixvimFactory alroady handles profile renaming and integration
let
inherit (lib)
mkEnableOption
mkOption
mkDefault
mkIf
types
lists;
cfg = config.programs.nixvims;
mkNixvimProfile = profile: ((nixvimFactory {
inherit pkgs;
module = profile.module // { wrapRc = true; };
extraSpecialArgs = profile.extraSpecialArgs;
}).overrideAttrs {
postInstall = ''
mv $out/bin/nvim $out/bin/nvim${profile.exeName}
''; # in the future wrapRc can be toggled to move config files within ~/.config/nvim subdirectories
});
genNixvimDrvs = profiles: (lists.forEach profiles (p:
mkNixvimProfile p
));
in
{
options.programs.nixvims = {
enable = mkEnableOption "enables nixvims";
profiles = mkOption {
type = types.listOf (types.submodule {
options = {
profileName = mkOption {
type = types.str;
default = "Default";
description = "the profile's config path name if exported";
};
exeName = mkOption {
type = types.str;
default = "default";
description = "the profile's executable name append nvim$exeName";
};
module = mkOption {
type = types.attrs;
default = { colorschemes.tokyonight.enable = true; };
description = "the modules as they would be passed to the makeNixvimWithModule function";
};
extraSpecialArgs = mkOption {
type = types.attrs;
default = { };
description = "the extraSpecialArgs as they would be passed to the makeNixvimWithModule function";
};
};
});
};
default = [ ];
description = "a list of profile attribute sets";
};
config = mkIf cfg.enable {
home.packages = [
#output of nixvimFactory should go here (start with one then do a map on profiles
pkgs.hello #placeholder
] ++ (genNixvimDrvs cfg.profiles);
};
} An example home config using the new nixvims module { self, inputs, config, pkgs, lib, nixvimFactory, ... }:
{
programs.nixvims = {
enable = true;
profiles = [
{
profileName = "Test";
exeName = "test";
module = { };
}
{
profileName = "Tokyo";
exeName = "tokyo";
module = { colorschemes.tokyonight.enable = true; };
}
{
profileName = "Gruv";
exeName = "gruv";
module = { colorschemes.gruvbox.enable = true; };
}
];
};
... |
After some more digging, I believe the derivation that nixvim produces does not run the |
Hello, Also, pinging @nix-community/nixvim to see if someone has a strong opinion. |
I love the idea and the usage looks pretty good imo. I used to have multiple neovim configurations separated by NVIM_APPNAME so I could have different setups to compare. |
If you're talking about nixvim's "standalone" build, then that's a If you would rather make changes to the underlying wrapped nvim package, exposed as We've also been brainstorming some fairly fundamental changes to how nixvim should be installed, so it might make sense to consider the use cases you are talking about in that upcoming redesign. In particular, I'm proposing we rely more transparently on
Maybe Getting a bit more into the weeds, your example looks interesting. In practice I think it may benefit from taking advantage of
Lines 49 to 52 in 4f1fe40
|
I want to run multiple styles of neovim configuration simultaneously on my systems. With NixVim, all config files are by default simlinked into the ~/.config/nvim directory (as a side note I am using the home-manager nixvim module). I want to be able to redefine where the nixvim generated config files are placed. After some digging into the nixvim codebase I see 2 potential places where the config filepath could be configured:
this one is probably wrong but worth mentioning. nixvim has a
path
top-level option which I can't seem to exactly understand is used how.looking at https://github.com/nix-community/nixvim/blob/main/wrappers/_shared.nix which is imported into each nixvim module wrapper (home-manager, nixos, darwin and standalone), I see a
filesPrefix
argument which is never really set but seems to solve the issue (it is set tonvim/
by default). However I don't see how I can set this variable myself.Assuming the second option is the correct path to configuring where nixvim, could anyone suggest how I can easily set the variable? If the task requires building another complex wrapper or some internal mods to this codebase, I would be happy to work on a pull request if given a bit of guidance (I would say my nix level is intermediate as I have some experience now reading through nix codebases). This could also lead to further improvements of nixvim whereby one could create multiple configs that could be switched using the recent NVIM_APPNAME env variable. This could eventually lead to something like https://lazyman.dev (or an integration with it) which could help people explore neovim through multiple configs and distros.
Any help on this matter is very much appreciated.
The text was updated successfully, but these errors were encountered: