Skip to content

Fixing nix-build issue on OSX where CoreServices was not found. #128

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

forficate
Copy link

Resolves the below error when building on OSX:

❯ nix-build
error: anonymous function at ~/Work/stack2nix/stack2nix.nix:16465:10 called without required argument 'CoreServices', at /nix/store/shm5fcq49wnwgjhpn4l05jzg53wm0h2b-nixpkgs-18.09pre151052.4477cf04b67/nixpkgs/pkgs/development/haskell-modules/make-package-set.nix:88:27
(use '--show-trace' to show detailed location information)

Note I also needed to override the pkgs value as I hit the clang to many arguments issue NixOS/nixpkgs#41340 .

❯ nix-build --arg pkgs 'import <nixpkgs> {}'

@domenkozar
Copy link
Contributor

Thanks, the fix belongs into default.nix as stack2nix.nix is autogenerated.

@shmish111
Copy link

@domenkozar I have come across this issue myself, how do I override this in default.nix, I can't work it out?

@domenkozar
Copy link
Contributor

Could actually be a bug in stack2nix, hackage2nix generates:

     }) {inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa; 
         inherit (pkgs.darwin.apple_sdk.frameworks) CoreServices;};
``

@shmish111
Copy link

Ah I see, yes that seems to work except that I'm getting stuck with clang: Argument list too long now :(

@shmish111
Copy link

nix-build (Nix) 2.1.2

@domenkozar
Copy link
Contributor

you should bump nixpkgs, this was a bug a few months ago.

@shmish111
Copy link

Hmm, I get the same with

➜  stack2nix git:(60c3698) ✗ nix-channel --list
nixpkgs https://nixos.org/channels/nixpkgs-18.09-darwin
unstable https://nixos.org/channels/nixpkgs-unstable
➜  stack2nix git:(60c3698) ✗ nix-channel --update
unpacking channels...
➜  stack2nix git:(60c3698) ✗ NIX_PATH=nixpkgs=/Users/davidsmith/.nix-defexpr/channels/unstable/ nix-build

and
NIX_PATH=nixpkgs=/Users/davidsmith/.nix-defexpr/channels/nixpkgs/ nix-build

@domenkozar
Copy link
Contributor

So the error happens when you build resulting stack2nix packages?

@shmish111
Copy link

no this is actually trying to build stack2nix, with the small change {inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa; inherit (pkgs.darwin.apple_sdk.frameworks) CoreServices;}; in stack2nix.nix

@domenkozar
Copy link
Contributor

@shmish111 we need to bump pinned nixpkgs :) btw, you can use stack2nix from nixpkgs and that surely works. Unless you're trying to contribute something.

@shmish111
Copy link

ok, no I'm not, I'll try that. I remember a while ago that I needed to install the latest so I guess I just got stuck on that. Thanks.

@forficate
Copy link
Author

Yes I went down bit of a rabbit hole trying to fix this.

I could not get stack2nix to add CoreServices to the output derivation so added manually not knowing the nix/haskell interop setup.

When that was resolved I got the clang: Argument list too long. I think I managed to resolve that then got another issue then another which took up a weekend when originally reporting that and haven't had a chance to look at it again yet. If I remember correctly I think I got to tracing some issues with cable2nix which where causing stack2nix to fail.

Yesterday I did a nix-channel --update using unstable on osx and stack2nix causes nix-env --update '*' to fail now.

It looks like stack2nix is broken currently, on osx at least. I'll see if I can find how I resolved the clang: Argument list too long issue and trace how far I got.

@domenkozar
Copy link
Contributor

@ajevans85 why not use stack2nix from nixpkgs, that should work. I'll see if I can fix it here as well.

Copy link

@sycured sycured left a comment

Choose a reason for hiding this comment

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

Works on macOS Catalina 10.15.4 (19E287)

@ryota-ka
Copy link

ryota-ka commented Sep 9, 2020

Is there a chance for this PR to be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants