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

Using fenix.overlay can prevent nix from downloading packages from cachix #79

Closed
MaeIsBad opened this issue Sep 1, 2022 · 7 comments
Closed
Labels
documentation Improvements or additions to documentation

Comments

@MaeIsBad
Copy link

MaeIsBad commented Sep 1, 2022

I ran into an issue where my laptop wasn't using the nix-community cache for fenix packages when building my system, despite using the fenix flake and not modifying the fenix nixpkgs input. This is because fenix will use super.callPackage in the overlay, which causes it to use the system nixpkgs and not the ones from the fenix.inputs.nixpkgs.

One solution is to replace the fenix overlay from the repo with a simple:

nixpkgs.overlays = [ (prev: _: { fenix = import fenix { system = prev.system; }) }

This isn't necessarily a bug, but I thought it might be worth it to document this behavior with an issue. Feel free to close or maybe consider mentioning this in the readme.

@figsoda figsoda added bug Something isn't working documentation Improvements or additions to documentation and removed bug Something isn't working labels Sep 1, 2022
@figsoda
Copy link
Member

figsoda commented Sep 1, 2022

Seems intended but I could be more clear about it in the readme. May I ask you what branch of nixpkgs are you using?

@MaeIsBad
Copy link
Author

MaeIsBad commented Sep 1, 2022

I'm using stable nixos-22.05 although I overlay some packages with their nixos-unstable counterparts

@MaeIsBad MaeIsBad changed the title Using fenix.overlay can prevent nix from downloading packages from cache Using fenix.overlay can prevent nix from downloading packages from cachix Sep 1, 2022
@figsoda
Copy link
Member

figsoda commented Sep 1, 2022

does this work for you?

{
  nixpkgs.overlays = [ (self: _: fenix.overlay self self) ];
}

@MaeIsBad
Copy link
Author

MaeIsBad commented Sep 1, 2022

no, that still causes some of the fenix related packages to be built from source instead of getting pulled from cachix

@figsoda
Copy link
Member

figsoda commented Sep 1, 2022

what about this

{
  nixpkgs.overlays = [ (_: super: (fenix.overlay { } { callPackage = x: _: import x { inherit (super) system; }; })) ];
}

or

{
  nixpkgs.overlays = [ (_: super: let pkgs = fenix.inputs.nixpkgs.legacyPackages.${super.system}; in fenix.overlay pkgs pkgs) ];
}

@MaeIsBad
Copy link
Author

MaeIsBad commented Sep 2, 2022

Both of those work for me, although the second one seems way cleaner

@figsoda
Copy link
Member

figsoda commented Sep 2, 2022

I added a note to the readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants