-
Notifications
You must be signed in to change notification settings - Fork 3
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
NixOS/nixpkgs?dir=lib #10
Comments
nixpkgs.url = "github:NixOS/nixpkgs";
nixpkgs-lib = {
url = "github:NixOS/nixpkgs?dir=lib";
}; I don't see why anyone should do this when they can simply access |
how do i set a dependent flake to use that? can i say follows "nixpkgs.lib"? |
You shouldn't really need a follows. lib is an output of nixpkgs, so you can just access it directly. {
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz"; # nixpkgs-unstable
outputs = { nixpkgs, ... }: let
inherit (nixpkgs) lib;
list1 = ["a" "b"];
list2 = ["c"];
in {
foo = lib.concatLists [list1 list2]; # ["a" "b" "c"]
};
} |
I guess what I mean is, I understand that. I don't intend to do that in my own flake, but I have a flake I want to use. How do I ensure that this flake, when referenced in my flake, gets the same nixpkgs lib as the one I use? https://github.com/hercules-ci/flake-parts/blob/main/flake.nix
and in my flake
I'm happy to offer a PR upstream if that's best? I don't know the exact reasoning to target the lib flake in flake-parts. |
Ah. If you look, flake-parts only accesses |
thank you! i did not understand that I could pass nixpkgs to nixpkgs-lib. I guess I understand how this works, it surprised me though. I will try to look closer at how the deps get used next time and try to decipher. Switching to flakehub soon. :-) |
idk where flakehub exists but i was wondering about something so im just gonna try here.
at some point subflakes i use had dependencies on nixpkg-lib and so to sync all the nixpkg reducing lock file,
i added a git flake to the same nixpkg i use but with
lib
subdir.maybe that's not the right way to do it. i'm still adapting to nix.
if i wanted to use flakehub, i don't think that would work.
i looked in the documentation and the dir option seems to be git specific.
i notice that the documentation only mentions the dir flag for git but i'm using it for github.
maybe it already works for tarballs? i should have just tried it?
or maybe what i'm doing with github provider is already wrong,
but i copied someone else's code so i'm unsure.
does it make send to make a nixpkgs-lib tar and distribute that as well?
maybe i need to restructure something like this? https://zimbatm.com/notes/1000-instances-of-nixpkgs
or there is some magic like using git+file here? NixOS/nix#3978 (comment)
The text was updated successfully, but these errors were encountered: