Hello,
I’m trying to adapt a flake that exports a package that I’m installing directly in a flake to additionally export the package + an overlay of that package, so I can use that overlay in my configuration and install it that way. I know the final outcome is the same, I’m learning nix.
I already modified the input flake (a neovim override) to export the overlay correctly but I’m having trouble with the nixpkgs revision used when I import that overlay in my configuration.
Now I have something like this:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
neovim-flake.url = "github:aorith/neovim-flake";
};
outputs = inputs: {
nixosConfigurations.trantor = inputs.nixpkgs.lib.nixosSystem {
...
modules = [
({pkgs, ...}: {nixpkgs.overlays = [overlay-unstable];})
({inputs, ...}: {environment.systemPackages = [inputs.neovim-flake.packages.${system}.default];})
./machines/trantor
];
};
};
}
I want to use the overlay instead:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
neovim-flake.url = "github:aorith/neovim-flake";
};
outputs = inputs: {
nixosConfigurations.trantor = inputs.nixpkgs.lib.nixosSystem {
...
modules = [
({pkgs, ...}: {nixpkgs.overlays = [overlay-unstable inputs.neovim-flake.overlays.default];})
./machines/trantor # adds 'pkgs.aorith.neovim' in environment.systemPackages
];
};
};
}
This “works” but the neovim overlay then uses the nixpkgs version from this flake instead of its own.
This causes the neovim flake to build with a nixpkgs which is pinned to some revision from 22.11 instead of the revision from its repository that comes from unstable (also, the build fails because I use a package that only exists in unstable).
I guess that this is expected and makes external overlays behave correctly, but, can I instead use the ‘flake.lock’ from the other repository somehow? I don’t known how to override the ‘pkgs’ argument in a module.
That would allow to have a consistent package between different systems, if it’s not possible then I’ll go back to install the package directly.
References:
- neovim-flake: GitHub - aorith/neovim-flake: Neovim configuration using a nix flake
- NixOS configuration: GitHub - aorith/nixconf: NixOS Configurations