nix-community / nixvim

Configure Neovim with Nix! [maintainers=@GaetanLepage, @traxys, @mattsturgeon, @khaneliman]
https://nix-community.github.io/nixvim
MIT License
1.75k stars 266 forks source link

[BUG] Following nixpkgs-unstable does not work #1291

Closed pinarruiz closed 7 months ago

pinarruiz commented 7 months ago
Field Description
Plugin Unrelated
Nixpkgs 23.11 and unstable
Home Manager 23.11

Description

I have setup my NixOs config on a flake. Following this guide which allows me to specify pkgs.unstable whenever i need an unstable package. Using the main branch of nixvim and setting the inputs.nixpkgs.follows = "nixpkgs-unstable"; does not seem to work, the error i get is

error: attribute 'base16-nvim' missing

       at /nix/store/6q4xansw31c5prvpp1jxb0pj5xqcnnxj-source/plugins/colorschemes/base16/default.nix:15:22:

           14|     originalName = "base16.nvim";
           15|     defaultPackage = pkgs.vimPlugins.base16-nvim;
             |                      ^
           16|
       Did you mean base16-vim?

of course is deeper than that, because in unstable this package exists, so is as if nixvim is taking 23.11 even if i specify unstable.

I do not know if this is to be expected and what i am suggesting here is impossible, but would be nice to have a way of specyfing the package source.

Minimal, Reproducible Example (MRE)

Flake inputs:

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";

    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";

    home-manager = {
      url = "github:nix-community/home-manager/release-23.11";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    agenix = {
      url = "github:ryantm/agenix/0.15.0";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        darwin.follows = "";
        home-manager.follows = "home-manager";
      };
    };

    nixvim = {
      url = "github:nix-community/nixvim";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };
  };

Thanks for the good work of nixvim, what a great project :smile:.

GaetanLepage commented 7 months ago

The issue here is that even though you have set inputs.nixpkgs.follows = "nixpkgs-unstable" for the nixvim input, this has no impact. Indeed, the pkgs attrs used by nixvim will be inherited from home-manager and will thus be following the 23.11 channel. If you want to have such a setup where your NixOS and HM systems follow a stable branch while having nixvim unstable is to configure the latter in a standalone flake. Here is an example: https://github.com/redyf/Neve

pinarruiz commented 7 months ago

Thanks @GaetanLepage this worked like a charm.

cudatuda commented 7 months ago

Doesn't work for me. I have both HM and Nixvim following nixpkgs-unstable, but still facing the same issue.

Here is my flake.nix:

  inputs = {

    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";

    home-manager = {
      url = "github:nix-community/home-manager/release-23.11";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };

    nixvim = {
      url = "github:nix-community/nixvim";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };

  };

Am i missing something?

GaetanLepage commented 7 months ago

Doesn't work for me. I have both HM and Nixvim following nixpkgs-unstable, but still facing the same issue.

If you are using HM as a NixOS module, then the same kind of logic may apply. HM has an option called useGlobalPkgs which decides which pkgs instance is used. Maybe try to look in this direction. Anyway, if you want to have stable NixOS but unstable nixvim, you might want to consider using a standalone flake.