-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
Search path fixes, v2 #14694
Search path fixes, v2 #14694
Conversation
Looks nice |
I had an idea right now to instead define |
This is just the tool I was looking for to fix the torbrowser derivation.. |
Notice that you can do it already -- just use EDIT: That is, if you aren't talking about |
c7a0c2e
to
50712b8
Compare
50712b8
to
162ee4e
Compare
This looks pretty great. I'd like to see this and #14766 merged. |
This looks OK to merge for me, but first I'd like to gather feedback on an idea briefly described in #14694 (comment). In more details: Right now we are slowly moving through splitting more and more packages. Also, we have a lot of packages that refer to other packages' outputs explicitly for various reasons, like What I propose instead is to add several most popular attributes to all packages by default. They would point to needed outputs in case the package was really split, and would be an alias if it wasn't. I think the most used ones are What do you think? I'm willing to try to implement that if people are interested. |
@abbradar I don't have any strong opinions. On the surface, that sounds nice though. /cc @edolstra -- I figure you might have opinions wrt #14694 (comment). |
else | ||
pkg.out or pkg | ||
) | ||
else pkg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why such a complex code? I'd write
if pkg.outputUnspecified or false
then pkg.${output} or pkg.out or pkg
else pkg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's because I'm constantly forgetting that I can do pkg.${foo}
in Nix!
I had thought of that briefly before. It seems the best way I know of to go in long term. To do that properly, these would have to react to vars like |
This PR looks good to me. (Mainly the general stuff; I only skimmed the package-specific changes.) I suppose we should go with it (or most of it) until someone implements that bigger plan outlined in my previous comment. |
162ee4e
to
8e8907f
Compare
Hm, I think that we indeed can merge it as is -- Rebased and updated as per @vcunat's comments (and replaced all the new |
90b4f54
to
7727bc3
Compare
@@ -58,7 +58,7 @@ let | |||
path = (makeBinPath ([ | |||
pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils pkgs.btrfs-progs | |||
pkgs.utillinux ] ++ (if cfg.efiSupport && (cfg.version == 2) then [pkgs.efibootmgr ] else []) | |||
)) + ":" + (makeSearchPathOutputs "sbin" ["bin"] [ | |||
)) + ":" + (makeSearchPathOutput "bin" "sbin" [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding sbin
to search paths is obsolete, since we automatically move sbin/*
to bin/
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I saw several places in code where sbin
was accounted for. Do we always move it, or are there exceptions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know of a possible reason not to move it. The occurrences are most likely just legacy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that dontMoveSbin
is unused in nixpkgs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought of looking through all our sbin
uses and replace them, but we have too much of them: grep -r 'sbin' | wc -l
shows 835 occurrences. I think removing them is out of scope of this PR, although I can remove those that I touched if desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be more fitting for a separate mass-replace commit. And I'd still probably leave the automatic sbin -> bin symlinks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I thought of just removing things like mentions in PATH
.
This reverts commit 338340f.
9f96163
to
daa8ba2
Compare
I'm getting a mass rebuild now which shouldn't be the case. How do we usually debug this? |
Ouch, it accidentally uncovered a bug in gcc wrapper D:
This incorrectly resolved to |
I'd say problems like these is why we need to encourage everyone to specify exactly what they mean instead of just a package and get the "get several outputs to all derivations as aliases" plan finished sooner (so that keystroke laziness would be less an issue). |
Just a few hours ago I used |
In the end I used So, what else should be done before merging this? I'm building |
I suppose we can stage it. The risk of mass breakage seems low enough. |
EDIT: by "does little" I meant "little" in terms of what could break: I suppose that if it worked before with incorrect path to EDIT2: Simples! It hasn't been broken because |
Sounds fine. |
Closed by 5f19542 |
Things done
nix-build --option build-use-chroot true
or nix.useChroot on NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)This is continuation of my attempts at having outputs correctly used tree-wise. We now have a more specific function
makeSearchPathOutput
, defined viagetOutput
-- a new function for getting output from a package with necessary checks and fallbacks. This function is very useful on its own, so I've run a few regexps tree-wise to use it instead of ad-hoca.needed or a.out or a
. What I don't like is that as of now ideally this function should be used anywhere to abstract from splitted/unsplitted packages, and that would be a slowdown and also clunky-looking. However it's better than ad-hoc fixes anyway and this is a price for multiple outputs -- a little one for its benefits ~_^.cc @vcunat @edolstra