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

Rework flake and overlay structures #124

Merged
merged 6 commits into from
Apr 17, 2023
Merged

Rework flake and overlay structures #124

merged 6 commits into from
Apr 17, 2023

Conversation

oxalica
Copy link
Owner

@oxalica oxalica commented Apr 17, 2023

It would be good to export functions in lib.nix under lib flake output. But it's not easy since select* depends on unpacked manifests, which depends on pkgs. Using interface lib.select* = pkgs: <drv> would unpack manifests every time when called.

@emilazy
Copy link

emilazy commented May 22, 2023

Maybe you could expose lib.${system}.whatever and (lib.forNixpkgs pkgs).whatever? I'm not sure what the proper convention is for system-specific library code, though; I've run into it before and didn't manage to find any common pattern for it. (Of course nixpkgs just puts it all in legacyPackages).

@oxalica
Copy link
Owner Author

oxalica commented May 23, 2023

lib.${system}.whatever locks nixpkgs and makes it hard to override things like stdenv (which is already hard #70) without forking another nixpkgs. lib.forNixpkgs pkgs cause re-evaluation on every usage. I don't know a perfect interfact design yet.

Flakify everything has low priority now. I saw many people still like instantiating nixpkgs once at root-level pkgs = import <nixpkgs> { overlays = [ overlays-from-every-flake ]; } and use pkgs.some-package everywhere else, instead of typing inputs.some-flake.packages.${nixpkgs-pkgs.stdenv.hostPlatform.system}.some-package for each individual usage. Flake interface suits more one-off use case like "just run some version of rustc". When special extensions, configuration, or dependency overriding is required, it immediately gets more complex than the traditional overlays.

@emilazy
Copy link

emilazy commented May 23, 2023

Oh, I wasn't proposing dropping the traditional overlays for when you do want to mess with nixpkgs. But I try to avoid overlays as much as possible, so it'd work well for me to avoid the additional nixpkgs import.

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.

None yet

2 participants