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

macOS support in the Nix flakes build system #275

Open
tchoutri opened this issue Nov 10, 2022 · 9 comments
Open

macOS support in the Nix flakes build system #275

tchoutri opened this issue Nov 10, 2022 · 9 comments
Labels
bug Something isn't working build:nix Nix build system

Comments

@tchoutri
Copy link
Contributor

Currently, macOS doesn't seem to be supported in the Nix build system.

@locallycompact, @bcardiff PRs are very welcome on this issue.

@bcardiff
Copy link

The flake-utils.lib.eachSystem [ "x86_64-linux" ] is also in

Including aarch64-darwin in this repo's flake.nix and in those locations lead to

error: attribute 'BNFC' missing

       at /nix/store/plwq03czv86m5y9wxyrz1sykgsq1asfz-source/pkgs/development/haskell-modules/configuration-arm.nix:47:20:

           46|   # TODO: figure out if needed on aarch32 as well
           47|   BNFC = dontCheck super.BNFC;
             |                    ^
           48|   C-structs = dontCheck super.C-structs;

from https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/configuration-arm.nix#L44-L47

@tchoutri
Copy link
Contributor Author

@locallycompact Any chance we could unlock this situation?

@locallycompact
Copy link
Contributor

locallycompact commented Nov 23, 2022

So there's no way I can test on darwin myself, but it looks to me like BNFC is missing from the package set. If we add it to the overides alongside flora in the flake.nix in this repository, does that help?

@tchoutri
Copy link
Contributor Author

@bcardiff Would this help?

@bcardiff
Copy link

I am not exactly sure what patch should be applied to try things. Specially since it seems to involve multiple repos. I can test things in x86 and M1 in macOS if directions are given.

@bcardiff
Copy link

Turns out souffle package is broken in darwin. I've just sent NixOS/nixpkgs#208373 in case it turns out useful.

@locallycompact
Copy link
Contributor

Ok so the reason for this error is because of some default values for arguments in make-package-set, I've fixed those upstream

https://gitlab.homotopic.tech/horizon/horizon-platform/-/blob/master/flake.nix#L41-43

I have no way of testing if this builds though and also the IFD causes evaluation errors on linux now, because it can't build cabal2nix for darwin, but here is a branch that should at least evaluate on darwin now, please let me know if it builds.

https://github.com/locallycompact/flora-server/tree/darwin

@bcardiff
Copy link

Thanks @locallycompact . This is the error I got from 51ae968 in aarch64-darwin

% make nix-shell
...
No uhc found
building
Preprocessing library for OneTuple-0.3.1..
Building library for OneTuple-0.3.1..
[1 of 3] Compiling Data.Tuple.Solo  ( src/Data/Tuple/Solo.hs, dist/build/Data/Tuple/Solo.o, dist/build/Data/Tuple/Solo.dyn_o )
[2 of 3] Compiling Data.Tuple.OneTuple ( src/Data/Tuple/OneTuple.hs, dist/build/Data/Tuple/OneTuple.o, dist/build/Data/Tuple/OneTuple.dyn_o )
[3 of 3] Compiling Data.Tuple.Solo.TH ( src/Data/Tuple/Solo/TH.hs, dist/build/Data/Tuple/Solo/TH.o, dist/build/Data/Tuple/Solo/TH.dyn_o )
[1 of 3] Compiling Data.Tuple.Solo  ( src/Data/Tuple/Solo.hs, dist/build/Data/Tuple/Solo.p_o )

src/Data/Tuple/Solo.hs:23:8: error:
    Could not find module ‘Prelude’
    Perhaps you haven't installed the profiling libraries for package ‘base-4.17.0.0’?
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
23 | module Data.Tuple.Solo (
   |        ^^^^^^^^^^^^^^^

src/Data/Tuple/Solo.hs:33:1: error:
    Could not find module ‘GHC.Tuple’
    Perhaps you haven't installed the profiling libraries for package ‘ghc-prim-0.9.0’?
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
33 | import GHC.Tuple (Solo (Solo), getSolo)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[3 of 3] Compiling Data.Tuple.Solo.TH ( src/Data/Tuple/Solo/TH.hs, dist/build/Data/Tuple/Solo/TH.p_o )

src/Data/Tuple/Solo/TH.hs:7:8: error:
    Could not find module ‘Prelude’
    Perhaps you haven't installed the profiling libraries for package ‘base-4.17.0.0’?
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
7 | module Data.Tuple.Solo.TH (
  |        ^^^^^^^^^^^^^^^^^^

src/Data/Tuple/Solo/TH.hs:13:1: error:
    Could not find module ‘Language.Haskell.TH’
    Perhaps you haven't installed the profiling libraries for package ‘template-haskell-2.19.0.0’?
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
13 | import Language.Haskell.TH (tupE)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: builder for '/nix/store/idcmlb61yg7kl4knjwmqf1lv7gnbligq-OneTuple-0.3.1.drv' failed with exit code 1;
       last 10 log lines:
       > 7 | module Data.Tuple.Solo.TH (
       >   |        ^^^^^^^^^^^^^^^^^^
       >
       > src/Data/Tuple/Solo/TH.hs:13:1: error:
       >     Could not find module ‘Language.Haskell.TH’
       >     Perhaps you haven't installed the profiling libraries for package ‘template-haskell-2.19.0.0’?
       >     Use -v (or `:set -v` in ghci) to see a list of the files searched for.
       >    |
       > 13 | import Language.Haskell.TH (tupE)
       >    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       For full logs, run 'nix log /nix/store/idcmlb61yg7kl4knjwmqf1lv7gnbligq-OneTuple-0.3.1.drv'.
error: 1 dependencies of derivation '/nix/store/i7i0di1b6pjcf1mifyn38z4zr7x9z2sa-ghc-9.4.2-with-packages.drv' failed to build
make: *** [nix-shell] Error 1

@kenranunderscore
Copy link
Contributor

If this gets revived/revisited at some point (maybe after #369), for the record: IIRC on aarch64-darwin profiling is by default disabled, while on the other default systems it's enabled. This often leads to errors like ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working build:nix Nix build system
Projects
None yet
Development

No branches or pull requests

4 participants