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

idris: fix modules #33069

Merged
merged 3 commits into from Feb 3, 2018
Merged

idris: fix modules #33069

merged 3 commits into from Feb 3, 2018

Conversation

brainrake
Copy link
Contributor

Motivation for this change

Some Idris modules (eg. lightyear, the non-builtin ones) were broken because they tried to use the meta.platforms attribute from the idris they were called with, but that was changed to a wrapper that didn't include the meta attribute, so the modules would not build with a missing attribute error.
This PR reuses Idris' meta.platforms variable in the wrapper, so the modules build successfully.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-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/)
  • Fits CONTRIBUTING.md.

@joachifm
Copy link
Contributor

joachifm commented Jan 7, 2018

cc @mpickering

@mpickering
Copy link
Contributor

@brainrape Perhaps you can try the heavily refactored infrastructure I have submitted in #31327 ?

I think this problem is fixed there.

@brainrake
Copy link
Contributor Author

@mpickering Looks like #31327 is stalled, in the mean time can we merge this one line change that fixes all the Idris libraries?

@mpickering
Copy link
Contributor

mpickering commented Feb 3, 2018

@brainrape It worked properly last time I tried it? In what sense do you mean it is stalled?

I don't have merge access to merge this change anyway sorry.

@brainrake
Copy link
Contributor Author

brainrake commented Feb 3, 2018

@mpickering I support #31327, appreciate the work done there, and would like to see it merged. However, I got the impression that it is not making progress towards being merged (changes requested, possibly further review required, conflict with master). In the mean time we could have working Idris modules in master with this small, easy to review PR.

@mpickering
Copy link
Contributor

OK, I can't merge this but #31327 is finished from my perspective. I'll try to rebase it now.

@brainrake
Copy link
Contributor Author

Thank you! Here's hoping it will make it all the way in this time. I'll close this when it does.

@mpickering
Copy link
Contributor

Your change was already merged.

69d4ade

@brainrake
Copy link
Contributor Author

brainrake commented Feb 3, 2018

@mpickering I'm not sure what you mean, the above commit seems unrelated to this. But lightyear and other idris libraries are broken in current master and need this PR to be fixed. Build output below:

└──> git show-ref HEAD
cff5eec3825f6158f8296eb194c2b1d53d36cad8 refs/remotes/origin/HEAD
└──> nix-shell -f . --attr idrisPackages.lightyear
error: attribute ‘platforms’ missing, at /home/ssdd/dev/nixpkgs/pkgs/development/idris-modules/lightyear.nix:25:11
(use ‘--show-trace’ to show detailed location information)

@mpickering
Copy link
Contributor

Yes sorry, my comment was wrong.

@mpickering
Copy link
Contributor

I rebased my other branch now if you want to try that for your use case.

@brainrake
Copy link
Contributor Author

brainrake commented Feb 3, 2018

@mpickering I checked out your branch and the Idris modules are still broken, and fixed by this PR in the same way. In conclusion, the two PRs are unrelated and this should definitely be merged in any case.
@shlevy could you do the honors? Thanks!

@mpickering
Copy link
Contributor

How are you building the packages? Are you using with-packages?

@brainrake
Copy link
Contributor Author

I included the build command and output, two comments up.

@brainrake
Copy link
Contributor Author

brainrake commented Feb 3, 2018

Yes, eventually, I would use the lightyear derivation as an argument to with-packages in my project. But evaluating the derivation fails before that.

@mpickering
Copy link
Contributor

mpickering commented Feb 3, 2018

Your command doesn't work for me.

I then tried nix-shell -p idrisPackages.lightyear which works fine for me locally.

87636ac3115920c71415f47ba6390031b01884d8git

You can see that the platforms attribute is set in meta in lightyear.nix.

@brainrake
Copy link
Contributor Author

To actually try to build the lightyear package (and not just start a shell in the build env as above), I'd use nix-build /path/to/nixpkgs --attr idrisPackages.lightyear

@mpickering
Copy link
Contributor

yes, that works fine for me.

nix-shell -p does build idrisPackage.lightyear, it creates a shell with idrisPackage.lightyear available.

You can see the platforms attribute is set in the lightyear deviation?

@brainrake
Copy link
Contributor Author

You have to add -f /path/to/nixpkgs, otherwise nix-shell will use NIX_PATH which is usually managed by nix-channel, possibly nixos-17.10 when it still worked, instead of your local checkout of nixpkgs.

@mpickering
Copy link
Contributor

mpickering commented Feb 3, 2018

My NIX_PATH points to my local nixpkgs.

[root@nixos:~/devel/nixpkgs]# echo $NIX_PATH
nixpkgs=/root/devel/nixpkgs:nixos-config=/etc/nixos/configuration.nix

You can look in the lightyear derivation and see that it sets platforms! I don't know what else to suggest sorry.

@brainrake
Copy link
Contributor Author

brainrake commented Feb 3, 2018

@mpickering yes, lightyear.nix sets platforms, but by inheriting from idris.meta, which is the one defined in idris-wrapper.nix and doesn't have a platforms attribute, which is exactly what this PR fixes!

@brainrake
Copy link
Contributor Author

brainrake commented Feb 3, 2018

Not sure why you can't reproduce. The commit you mentioned above is broken for me, and works if I add the line in this PR.

@mpickering
Copy link
Contributor

Which platform are you on?

@mpickering
Copy link
Contributor

I can't find anther use of symlinkJoin which sets any meta attribute.

@brainrake
Copy link
Contributor Author

brainrake commented Feb 3, 2018

My platform is NixOS, as stated in the PR description. x86_64. I don't get it.. that attribute is really missing, and any package that uses idris-wrapper.nix and tries to inherit its platforms will surely fail, plain as day.
Not sure how symlinkJoin fits in the picture... I read the source at https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L76 and it just passes on the args you give it, more or less.

Here's the story again, if it wasn't clear from the description. There's an idris package that has a meta.platforms attribute. Lightyear inherited the platforms attribute from it. But then idris-wrapper was created to address #10450 and replaced idris in lightyear etc. It did not define a platforms attribute. So the the packages that tried to inherit it, like lightyear, failed with attribute not found. So I added the attribute.

I suspect you're somehow not building the right nixpkgs. I don't see how anything else (eg. sandbox) could affect this, I traced the evaluation and couldn't find any way to divine platforms.

This discussion is getting a bit out of hand for a straightforward one-line change, and I'm sorry to mention this but a lot of the above comments didn't check out. I'm convinced though that we're both acting in good faith and want the same thing (working nixpkgs) so maybe we need a fresh perspective. Let's let someone else take a look. @joachifm could you check this out please?

Basically:

nix-build /path/to/nixpkgs --attr idrisPackages.lightyear

On current master, It should fail with error: attribute ‘platforms’ missing, and this PR will fix it so should be merged. If not, I missed something weird, but it still fails for me, and we should find out why.
Thank you, and happy coding!

@mpickering
Copy link
Contributor

@infinisil tried it on IRC and got the same error message as you. I really wish I could reproduce this.. I have tried on master and my branch.

@mpickering
Copy link
Contributor

@GrahamcOfBorg build idrisPackages.lightyear

@infinisil
Copy link
Member

I am worried we're having some problems with non-reproducibility, reported by @FRidh earlier today: #33362 (comment)

@7c6f434c
Copy link
Member

7c6f434c commented Feb 3, 2018

@GrahamcOfBorg build idrisPackages.lightyear

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Partial log (click to expand)

Package ‘jailbreak-cabal-1.3.2’ in /var/lib/gc-of-borg/nix-test-rs-3/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-3/pkgs/development/haskell-modules/hackage-packages.nix:118872 is not supported on ‘aarch64-linux’, refusing to evaluate.

a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowBroken = true; }
to ~/.config/nixpkgs/config.nix.

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

Installing Lightyear/Char.ibc to /nix/store/cgn32wwnynwjnrkfj60jcx1chf9bn24z-lightyear-2017-09-10/lib/idris-1.2.0/lightyear/Lightyear
Installing Lightyear/Testing.ibc to /nix/store/cgn32wwnynwjnrkfj60jcx1chf9bn24z-lightyear-2017-09-10/lib/idris-1.2.0/lightyear/Lightyear
Installing 00lightyear-idx.ibc to /nix/store/cgn32wwnynwjnrkfj60jcx1chf9bn24z-lightyear-2017-09-10/lib/idris-1.2.0/lightyear
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/cgn32wwnynwjnrkfj60jcx1chf9bn24z-lightyear-2017-09-10
strip is /nix/store/5qj61lcvzlap87rf6blvf8p577d482bv-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/cgn32wwnynwjnrkfj60jcx1chf9bn24z-lightyear-2017-09-10/lib 
patching script interpreter paths in /nix/store/cgn32wwnynwjnrkfj60jcx1chf9bn24z-lightyear-2017-09-10
checking for references to /tmp/nix-build-lightyear-2017-09-10.drv-0 in /nix/store/cgn32wwnynwjnrkfj60jcx1chf9bn24z-lightyear-2017-09-10...
/nix/store/cgn32wwnynwjnrkfj60jcx1chf9bn24z-lightyear-2017-09-10

@brainrake
Copy link
Contributor Author

^ is this on this branch or master?

@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Partial log (click to expand)

patching script interpreter paths in /nix/store/iy8qq9y5shs7gnmyw1k9ia15jighag3x-aeson-1.2.3.0
strip is /nix/store/5a88zk3jgimdmzg8rfhvm93kxib3njf9-cctools-binutils-darwin/bin/strip
patching script interpreter paths in /nix/store/10nmnly3n0xq9jjh6y899r7v62naxn0f-aeson-1.2.3.0-doc
cannot build derivation '/nix/store/yf8vmbxsqvq8d1r8kh77lylm15whzn5f-idris-1.2.0.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/7h423jq9nivjl9zarv5fpzc82jp5i9yq-idris-1.2.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/8jk0fhzjv7rxv41qvclq70rqvyd0i3hg-prelude-1.2.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/c4ibh1g19di1myyvnmx3sbq0xspxfp3g-base-1.2.0.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/vcbpbw968r9ad3rm4wyh0pix75ffwk5g-effects-1.2.0.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/nclf56w330vg70rvqpb0cfvycmda5hzp-lightyear-2017-09-10.drv': 4 dependencies couldn't be built
error: build of '/nix/store/nclf56w330vg70rvqpb0cfvycmda5hzp-lightyear-2017-09-10.drv' failed

@7c6f434c
Copy link
Member

7c6f434c commented Feb 3, 2018

On this branch

@mpickering
Copy link
Contributor

@brainrape on this branch.

I think I can't reproduce this because I have "allowBroken" in my config but I can't work out how to properly disable it.

@7c6f434c
Copy link
Member

7c6f434c commented Feb 3, 2018

Interesting… I don't know enough about Idris to understand why the error from Darwin failure doesn't occur on Linux.

@mpickering
Copy link
Contributor

@brainrape Thank you very much for your patience. I can now reproduce this after unsetting allowBroken.

@7c6f434c I think the failure is not to do with this patch but an already existing issue.

@7c6f434c
Copy link
Member

7c6f434c commented Feb 3, 2018

Yes, but you may want to set a more narrow meta.platforms

@mpickering
Copy link
Contributor

The right place would be on the haskell packages which are failing to build. I can't work out why they are though. Merging this is the right thing to do for now I think, however in future I think it would be better to set meta.platforms on a per idris module level as idris modules can call C FFI like haskell modules.

@7c6f434c 7c6f434c merged commit 2a541cc into NixOS:master Feb 3, 2018
@brainrake
Copy link
Contributor Author

Thank you for all your help in elucidating this issue.

@brainrake brainrake deleted the fix-idris-modules branch March 16, 2018 02:12
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