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] Implement RFC0035 II: Electric Boogaloo #49769

Merged
merged 18 commits into from Nov 6, 2018

Conversation

Synthetica9
Copy link
Member

@Synthetica9 Synthetica9 commented Nov 5, 2018

Motivation for this change

Follow-up for #49398

TODO:

Should I split this up in two PR's? Part of this is good to go and should just go in the working tree straight away.

  • The basic change
  • Consistency check
  • Check the entire tree is consistent (it is now!)
  • Document the new check
  • Docs for the new hasInfix library function
  • Currently interacts really weirdly with Coq, and I have no idea why.
  • Check everything still works.

cc @dtzWill

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@Synthetica9
Copy link
Member Author

Ofborg's current output is the problem I'm having with Coq, and I'm not sure what is even happening, so any help is welcome there

@Zimmi48
Copy link
Member

Zimmi48 commented Nov 5, 2018

cc @vbgl You might have an idea about the Coq-related issue in this PR.

@Zimmi48
Copy link
Member

Zimmi48 commented Nov 5, 2018

@Synthetica9 If I understand correctly, this allows the scheme name = "ocaml${ocaml.version}-${pname}-${version}" or name = "coq${coq.version}-${pname}-${version}", etc. Correct?

@Synthetica9
Copy link
Member Author

@Synthetica9 If I understand correctly, this allows the scheme name = "ocaml${ocaml.version}-${pname}-${version}" or name = "coq${coq.version}-${pname}-${version}", etc. Correct?

Correct. The current check is whether both pname and version (if the attributes exist) appear in name in their entirety. So any prefix, postfix, whatever is allowed. This was the most forgiving check I could think of that still meant anything, and it found a few genuine problems (see: most of the commits in this PR).

@vbgl
Copy link
Contributor

vbgl commented Nov 5, 2018

May I suggest that the issue is in your code rather than in the Coq package descriptions? It seems that the checks are run too early.

Please do remove the failing assertions (assert param != null). They break evaluation.

Copy link
Member

@zimbatm zimbatm left a comment

Choose a reason for hiding this comment

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

if all of this compiles, then let's get this merged in first

pkgs/applications/misc/k2pdfopt/default.nix Show resolved Hide resolved
pkgs/applications/misc/oneko/default.nix Outdated Show resolved Hide resolved
pkgs/applications/misc/oneko/default.nix Outdated Show resolved Hide resolved
pkgs/applications/networking/remote/remmina/default.nix Outdated Show resolved Hide resolved
@vbgl
Copy link
Contributor

vbgl commented Nov 5, 2018

Can we ensure that mkDerivation is lazy? We rely on this property in coqPackages.

@Synthetica9
Copy link
Member Author

Can we ensure that mkDerivation is lazy? We rely on this property in coqPackages.

Only in the places altered in 0ab59bc37b21a13dc35b9d902d78f26af4bb56f2? Because I am currently testing a fix that should fix the issues caused by that. It seems to work fine (testing by compiling coqPackages_8_8)

  param = params."${coq.coq-version}" or null;
in

if param == null then null else
stdenv.mkDerivation rec {

@vbgl
Copy link
Contributor

vbgl commented Nov 5, 2018

What would be the value of builtins.hasAttr "coqprime" coqPackages_8_5 with your fix? I expect “false”.

@Synthetica9
Copy link
Member Author

@vbgl Everything should be okay now!

@vbgl
Copy link
Contributor

vbgl commented Nov 5, 2018

Thanks for your understanding. LGTM.

@Synthetica9
Copy link
Member Author

(Rebased to squash some commits, clarify a few messages, and solve merge conflicts)

@Synthetica9
Copy link
Member Author

Synthetica9 commented Nov 6, 2018

Currently building on my Hydra (private, so no link, sorry!)

Seems to work fine (ran out of disk space at about 50%, but no errors yet):

@Synthetica9
Copy link
Member Author

@Mic92 Willing to give this another try?

@Mic92 Mic92 merged commit 424c38b into NixOS:staging Nov 6, 2018
@Synthetica9
Copy link
Member Author

Synthetica9 commented Nov 6, 2018

Okay, next order of business is doing refactors in the tree to make packages use this pattern. I think that should go in master, once this PR gets there, am I correct?

@timokau
Copy link
Member

timokau commented Nov 6, 2018

Usually. If it actually changes the resulting name it will cause rebuilds though. If the package is high enough in the dpendency tree, that should go to staging. So if ofBorg reports excessive (>100) rebuilds, rebase on staging.

@Synthetica9
Copy link
Member Author

I was thinking of packages that define name = "${pname}-${version}", which shouldn't cause rebuilds at all, right?

@timokau
Copy link
Member

timokau commented Nov 6, 2018

Not sure, since the default builder will add pname as an environment variable for the build I think.

@dtzWill
Copy link
Member

dtzWill commented Nov 14, 2018

nixos-version was failing this check for me--but I might have missed some of the new goodness, and due to strange network problems it's not easy to confidently check against master right now. It's probably been fixed but if not thought I'd mention just in case :).

@Synthetica9
Copy link
Member Author

Synthetica9 commented Nov 14, 2018 via email

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/avoid-rec-expresions-in-nixpkgs/8293/4

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