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

[WIP] stdenv: inherit src.meta to allow moving most of meta into src.meta #35075

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

oxij
Copy link
Member

@oxij oxij commented Feb 17, 2018

Motivation for this change

You can now move meta.license or any other such thing to the src attribute of your derivation and by doing so ban the accidental downloading of the sources of softwares you blacklisted with check-meta.

In my opinion, moving most of meta into src makes sense. For instance, homepage is an attribute of a source, not an attribute of a derivation.

See commit messages for more info.

Things done
  • Nothing really changes (except meta.evaluates -> meta.available).
  • Fits CONTRIBUTING.md.

@oxij
Copy link
Member Author

oxij commented Feb 17, 2018 via email

@oxij oxij changed the title stdenv: inherit src.meta [WIP] stdenv: inherit src.meta Feb 17, 2018
@oxij oxij changed the title [WIP] stdenv: inherit src.meta stdenv: inherit src.meta Feb 17, 2018
@oxij oxij mentioned this pull request Feb 17, 2018
8 tasks
@oxij
Copy link
Member Author

oxij commented Feb 17, 2018

Strictly speaking its still WIP as many other packages that do throw in src will be broken by check-meta. But I don't want to touch them before we decide what to do with #34755 as it proposes a better syntax than 37dedf64536f366df730584b5fb285b0469d2bea.

@oxij
Copy link
Member Author

oxij commented Feb 17, 2018

Btw

  • Nothing really changes.

is still correct. The manual changes a bit because I added some documentation. Other changes seen by ofborg are not actual changes. The contents of .drvs doesn't change, their hashes change, but since they are fixed-output it wouldn't rebuild anything.

@7c6f434c
Copy link
Member

I like most of the changes, but I think the allowBinary should be a separate PR, because there are a lot of things to discuss about it. Technically, bootstrap tools for stdenv (a transitive dependency of everything…) are a binary blob. Then there are Rust, GHC, SBCL, FPC… that we bootstrap from upstream binaries.

@oxij oxij changed the title stdenv: inherit src.meta stdenv: inherit src.meta to allow moving most of meta into src.meta Feb 17, 2018
@oxij
Copy link
Member Author

oxij commented Feb 17, 2018

Agreed. Will do after a couple of other TODO items.

@7c6f434c
Copy link
Member

I probably like the meta.available name better, but renaming meta.evaluates is an externally visible change.

@oxij
Copy link
Member Author

oxij commented Feb 17, 2018

I just introduced it in #33057, so

  • I don't think anyone outside nixpkgs uses it yet.
  • There were no stable releases with this feature so I feel like its fine to change it without any grace period. Its master, after all.

Actually, that patch is from another related branch where it makes even more sense, but I thought it wouldn't hurt if it cuts in line here instead (as that other branch will almost surely generate copious amounts bikeshedding).

@7c6f434c
Copy link
Member

I agree no-grace-period is OK, I would just list it in the description below ‘‘Nothing really changes’’, as it is a change.

@7c6f434c 7c6f434c changed the title stdenv: inherit src.meta to allow moving most of meta into src.meta [WIP] stdenv: inherit src.meta to allow moving most of meta into src.meta Feb 17, 2018
@7c6f434c
Copy link
Member

Added a WIP tag because you explicitly say that there are TODO items you plan to implement here anyway (you wouldn't be able to drop a label, but you can undo my change to the title).

@oxij
Copy link
Member Author

oxij commented Feb 17, 2018

Ok. allowBinary stashed away. The only TODO left here is #35075 (comment). I feel like stealing a patch from #34755 and fixing all the things this breaks using it here. Lets discuss the thing there.

@7c6f434c
Copy link
Member

I think getAttrByName you proposed there is called builtins.getAttr, but maybe you want better error reporting.

@oxij
Copy link
Member Author

oxij commented Feb 18, 2018 via email

@oxij oxij mentioned this pull request Feb 18, 2018
2 tasks
@@ -36,7 +36,7 @@ let
package = args.package or (lib.attrByPath path (throw "Invalid package attribute path `${toString path}'") pkgs);
in "<listitem>"
+ "<para><literal>pkgs.${name} (${package.meta.name})</literal>"
+ lib.optionalString (!package.meta.evaluates) " <emphasis>[UNAVAILABLE]</emphasis>"
+ lib.optionalString (!package.meta.available) " <emphasis>[UNAVAILABLE]</emphasis>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could the broken attribute be re-used there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think broken has a more narrow meaning (this stopped working where it worked before), and the check also includes platforms and license?

license = licenses.gpl2;
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
};
url = "unsupported on ${stdenv.system}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is that error displayed? it might be better to add a throw keyword to make it more explicit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this part too. I would prefer for check-meta to give that error. Hence lazy fetchurl patch. But its ugly.

@oxij
Copy link
Member Author

oxij commented Feb 19, 2018 via email

@oxij
Copy link
Member Author

oxij commented Feb 19, 2018 via email

@zimbatm
Copy link
Member

zimbatm commented Feb 19, 2018

Let's postpone the discussion around pkgs/development/mobile/androidenv/platform-tools.nix and fetchurl. The rest of the code makes sense and could be merged already. I would also like to have a multi-fetcher but it has to be fleshed out a bit more.

@oxij
Copy link
Member Author

oxij commented Feb 19, 2018

You see, I just wanted the first two commits. But manual build then fails because src.meta fails for the unlazy fetchurl which breaks meta of platformTools which is used to generate documentation. So I started fixing that and got where I'm now. Of course, I can just hack around it, but I prefer to waste some time now experimenting, that waste some time later hacking around the hacks.

Immediate effect: no need to do `meta.homepage = src.meta.homepage` anymore.
See the next patch.

Less immediate effect: you can now move `meta.license` or any other such thing
to the `src` attribute of your derivation and by doing so ban the accidental
downloading of the sources of softwares you blacklisted with check-meta.

In my opinion, moving most of `meta` into `src` makes sense. For instance,
`homepage` is an attribute of a source, not an attribute of a derivation.
@oxij
Copy link
Member Author

oxij commented Feb 19, 2018

Rebased to remove already merged commits. Still WIP and is going to be WIP for a while.

# } // optionalAttrs (stdenv.system == "x86_64-linux") {
# url = ...;
# sha256 = ...;
# })
Copy link
Member

@zimbatm zimbatm Feb 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this pattern is necessarily a good thing. A similar result could be achieved with fetchSource as proposed in the other PR:

let
  meta = { ... };
in
  fetchSource {
    x86_64-linux = fetchurl { url = ...; sha256 = ...; inherit meta; };
    ...
  } stdenv.system

@oxij
Copy link
Member Author

oxij commented Feb 20, 2018 via email

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 3, 2020
@ryantm ryantm marked this pull request as draft October 23, 2020 03:13
@stale
Copy link

stale bot commented Apr 26, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants