Skip to content
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

flake: add overlay as an alternative to legacyPackages #668

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

PatrickDaG
Copy link
Contributor

This adds an overlay containing both makeNixvim functions. This simplifies usage of the functions, as well as enabling you to use your own preinstantiated package set, instead of the one from this flake.

@GaetanLepage GaetanLepage requested a review from traxys October 25, 2023 05:54
@traxys
Copy link
Member

traxys commented Oct 28, 2023

I'm not too sold out on the overlay, you can easily access those functions through module._args if you use NixOS modules, or through extraSpecialArgs for Home-Manager.

For the case of using a predefined nixpkgs there is the option with makeNixvimWithModule to pass a pkgs argument.

I find it a bit weird to add non package (even non derivation) attributes to an overlay.

Maybe we are lacking in the documentation?

@PatrickDaG
Copy link
Contributor Author

I would like to refrain form using either the nixos or home manager modules just to get the functions, as I don't intend to use the options.
With the current legacyPackages approach, this requires me to be able to refer to my flake's inputs at the point where I want to call makeNixvimWithModule, and also requires me to know the current system. So this would be come this rather unwieldy expression:

# home-manager.extraSpecialArgs.flakeInputs = flakeInputs;
{ flakeInputs, pkgs, ... }: {
  home.shellAliases.secondaryVim = lib.getExe (flakeInputs.nixvim.legacyPackages.${pkgs.stdenv.hostPlatform.system}.makeNixvimWithModule {
    inherit pkgs;
    module.config = {
      # <nixvim config>
      # globals.mapleader = ",";
    };
  });
}

By exposing the function as an overlay you would implicitly add the correct system context without any extra effort, and this becomes much more readable:

{ pkgs, ... }: {
  home.shellAliases.secondaryVim = lib.getExe (pkgs.nixvim.makeNixvim {
    # <nixvim config>
    # globals.mapleader = ",";
  });
}

Copy link
Member

@GaetanLepage GaetanLepage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As your proposal is simply an addition and would not affect any current user, I have nothing against it.
I don't see any reason why not to add that as yet an extra way to declare a nixvim configuration.
@traxys don't you think that we could just go and experiment with that ? Removing will obviously remain an option if this causes any negative effect.

@traxys traxys merged commit 2019968 into nix-community:main Nov 1, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants