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

treewide: never assert stdenv.isLinux or stdenv.isDarwin #37029

Closed
wants to merge 1 commit into from

Conversation

matthewbauer
Copy link
Member

Assertions shouldn't be used in Nixpkgs for checking the platform. "meta.platforms" provides a much more robust way of handling this.

This treewide commit removes all references to 'assert stdenv.isLinux' and 'assert stdenv.isDarwin'.

meta.platforms can handle this for us
@GrahamcOfBorg GrahamcOfBorg added the 6.topic: darwin Running or building packages on Darwin label Mar 14, 2018
@dezgeg
Copy link
Contributor

dezgeg commented Mar 15, 2018

I think there's a problem though that the attributes of the derivation are often evaluated before meta.platforms - e.g. the Borg reports:

error: while evaluating anonymous function at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/.gc-of-borg-outpaths.nix:35:12, called from /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/lib/attrsets.nix:199:52:
while evaluating the attribute 'x86_64-darwin' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/lib/attrsets.nix:185:41:
while evaluating anonymous function at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/pkgs/top-level/release-lib.nix:71:6, called from /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/lib/attrsets.nix:282:43:
while evaluating 'hydraJob' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/lib/customisation.nix:162:14, called from /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/pkgs/top-level/release-lib.nix:71:14:
while evaluating the attribute 'outPath' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/lib/customisation.nix:178:13:
while evaluating the attribute 'outPath' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/lib/customisation.nix:147:13:
while evaluating the attribute 'postInstall' of the derivation 'sysdig-0.20.0' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating 'optionalString' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/lib/strings.nix:138:26, called from /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/pkgs/os-specific/linux/sysdig/default.nix:38:17:
while evaluating the attribute 'dev.outPath' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/lib/customisation.nix:147:13:
while evaluating the attribute 'configurePhase' of the derivation 'linux-4.14.26' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating the attribute 'kernelArch' of the derivation 'linux-config-4.14.26' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating the attribute 'platform.kernelArch' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-0-gleber.ewr1.nix.ci/lib/systems/default.nix:25:7:

@dezgeg
Copy link
Contributor

dezgeg commented Mar 15, 2018

Or hmm, maybe it's actually that sysdig declares darwin in meta.platforms when it shouldn't. Regardless, something to investigate.

@dezgeg
Copy link
Contributor

dezgeg commented Mar 15, 2018

Or maybe it's that pkgs/os-specific/linux/kernel/generic.nix doesn't specify a meta.platforms for e.g. linuxPackages_4_14.kernel.configfile.

@matthewbauer
Copy link
Member Author

Closing for now. If anyone wants to take this cause up, feel free to reuse this stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants