stack2nix
stack2nix copied to clipboard
Fixing `nix-build` issue on OSX where `CoreServices` was not found.
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 https://github.com/NixOS/nixpkgs/issues/41340 .
❯ nix-build --arg pkgs 'import <nixpkgs> {}'
Thanks, the fix belongs into default.nix as stack2nix.nix is autogenerated.
@domenkozar I have come across this issue myself, how do I override this in default.nix, I can't work it out?
Could actually be a bug in stack2nix, hackage2nix generates:
}) {inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa;
inherit (pkgs.darwin.apple_sdk.frameworks) CoreServices;};
``
Ah I see, yes that seems to work except that I'm getting stuck with clang: Argument list too long now :(
nix-build (Nix) 2.1.2
you should bump nixpkgs, this was a bug a few months ago.
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
So the error happens when you build resulting stack2nix packages?
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
@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.
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.
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.
@ajevans85 why not use stack2nix from nixpkgs, that should work. I'll see if I can fix it here as well.
Is there a chance for this PR to be merged?