obelisk
obelisk copied to clipboard
obelisk not installing on macOS 12.3 on M1 based mac
Decided to try checking out obelisk today because I was hoping for a relatively smooth developer experience because I'm fairly experienced with frontend developer experience.
Unfortunately was greeted with this error message. (click me)
❮ nix-env -f https://github.com/obsidiansystems/obelisk/archive/master.tar.gz -iA command --show-trace
error: while evaluating the attribute 'obelisk-command' at /nix/store/ycahcdxpnan0rwljqb5a1d52hvicsngy-master.tar.gz/haskell-overlays/tighten-ob-exes.nix:18:3:
while evaluating 'overrideCabal' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/lib.nix:37:24, called from /nix/store/ycahcdxpnan0rwljqb5a1d52hvicsngy-master.tar.gz/haskell-overlays/tighten-ob-exes.nix:18:21:
while evaluating 'generateOptparseApplicativeCompletion' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/lib.nix:387:52, called from /nix/store/ycahcdxpnan0rwljqb5a1d52hvicsngy-master.tar.gz/haskell-overlays/tighten-ob-exes.nix:19:6:
while evaluating 'overrideCabal' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/lib.nix:37:24, called from /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/lib.nix:387:57:
while evaluating 'justStaticExecutables' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/lib.nix:244:27, called from /nix/store/ycahcdxpnan0rwljqb5a1d52hvicsngy-master.tar.gz/haskell-overlays/tighten-ob-exes.nix:20:8:
while evaluating 'overrideCabal' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/lib.nix:37:24, called from /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/lib.nix:244:32:
while evaluating the attribute 'obelisk-command' at /nix/store/ycahcdxpnan0rwljqb5a1d52hvicsngy-master.tar.gz/haskell-overlays/obelisk.nix:19:3:
while evaluating 'overrideCabal' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/lib.nix:37:24, called from /nix/store/ycahcdxpnan0rwljqb5a1d52hvicsngy-master.tar.gz/haskell-overlays/obelisk.nix:19:21:
while evaluating 'callCabal2nix' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:216:32, called from /nix/store/ycahcdxpnan0rwljqb5a1d52hvicsngy-master.tar.gz/haskell-overlays/obelisk.nix:19:47:
while evaluating 'callCabal2nixWithOptions' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:201:66, called from /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:216:38:
while evaluating 'overrideCabal' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/lib.nix:37:24, called from /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:212:10:
while evaluating 'callPackageKeepDeriver' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:157:33, called from /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:212:25:
while evaluating 'overrideCabal' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/lib.nix:37:24, called from /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:158:5:
while evaluating 'callPackage' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:114:22, called from /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:158:20:
while evaluating 'callPackageWithScope' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:74:37, called from /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:114:28:
while evaluating 'makeOverridable' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/lib/customisation.nix:67:24, called from /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:97:8:
while evaluating 'drvScope' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:87:18, called from /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/lib/customisation.nix:69:16:
while evaluating the attribute 'nativeBuildInputs' of the derivation 'cabal2nix-obelisk-command' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/make-package-set.nix:126:7:
while evaluating the attribute 'buildInputs' of the derivation 'cabal2nix-2.15.5' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/generic-builder.nix:290:3:
while evaluating the attribute 'configurePhase' of the derivation 'language-nix-2.2.0' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/haskell-modules/generic-builder.nix:290:3:
while evaluating the attribute 'buildInputs' of the derivation 'coreutils-8.31' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/stdenv/generic/make-derivation.nix:192:11:
while evaluating the attribute 'depsBuildBuild' of the derivation 'gmp-6.2.0' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/development/libraries/gmp/6.x.nix:14:3:
while evaluating the derivation attribute 'name' at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/stdenv/generic/make-derivation.nix:192:11:
cannot coerce null to a string, at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/stdenv/generic/make-derivation.nix:192:19
and then came to the issue tracker to see several issues associated with obelisk's instability on macs:
- https://github.com/obsidiansystems/obelisk/issues/869
- https://github.com/obsidiansystems/obelisk/issues/895
- https://github.com/obsidiansystems/obelisk/issues/902
My mac is 2021 14 inch Macbook Pro with a M1 Pro chip.
My nix version is: nix (Nix) 2.3.16
This is currently an issue for me as well. And although I tried a workaround by using an arm64 linux VM, that appears to not currently be working either.
Let me know if you (or anyone) finds any workarounds for this!
Currently my workaround for this is just to separate out my obelisk project into two separate cabal projects -- one I can build with obelisk and nix via github actions, and another I can run locally with jsaddle-warp, built with cabal.
Depending on how many of features of Obelisk you use, this may or may not be practical for your use case, but if you want to give it a shot, this is how I'm doing it in my project:
https://github.com/Sintrastes/montague-reflex/tree/reflex_platform
See there the m1-frontend
directory, and the alternate m1-cabal.project
. When I want to try out my project on my M1, I just run:
cabal --project-file=m1-cabal.project run m1-frontend
I had this issue when I started trying out obelisk for our project last October. And I have a pretty solid workaround after several day's struggling.
There're two problems running Obelisk on M1 mac. First, obelisk doesn't have support for new version of GHC that work on ARM yet. It's X86 only. Second, there's a linker issue on MacOS preventing lots of NIx installed binaries from working, as mentioned in #869 . This is not specific to M1. This bug has been fixed in newer version of Nix (since 21.05), but Obelisk is still stuck with nixpkgs 19.05.
My workaround problem 1:
1, uninstall the default ARM version Nix.
2, Install nix. Instead of use the one-line bash to install nix directly, download that nix install script and change the "system" variable to x86_64-darwin and run it to install the x86_64 version of NIx.
3, Add "system = x86_64-darwin" to /etc/nix/nix.conf as well to force Nix to install x86_64 packages.
Now we have a x86_64 version of Nix system on M1 mac. All code will be run on Rosetta 2 automatically.
Workaround problem 2: Based on the obelisk and reflex-platform repo, I've forked to use Nixpkgs-21.05 and force to use the newer 8.10.7 version of GHC. My work is based on existing ghc-8.10 work in both obelisk and reflex-platform. And then update some package versions to make everything work on nixpkgs-21.05. Here's how to install it:
1, setup nix cache just as documented in this repo.
2, Instead of installing obelisk with the one-line nix-env code, clone my repo first:
git clone https://github.com/ProEnergyVIP/obelisk.git
3, checkout my new branch:
git checkout proenergy/ghc-8.10
4, install obelisk with:
nix-env -f . -iA command
it will install the working obelisk and all dependencies.
When creating your new obelisk project, use this:
ob init --branch proenergy/ghc-8.10
It will setup build time dependencies for your project correctly.
Now you can use obelisk!
Using @manyoo's branch, the dependency installation still fails on my machine (NixOS arm64 VM) with the following:
[2 of 5] Compiling Data.Conduit.StreamSpec ( test/Data/Conduit/StreamSpec.hs, dist/build/conduit-test/conduit-test-tmp/Data/Conduit/StreamSpec.o )
/nix/store/kdzr4n2xj8ynz1zn1n54ly4ybg7l63b0-stdenv-linux/setup: line 1310: 267 Killed ./Setup build
builder for '/nix/store/s96xgci5bn748qr904yxi581p427bmkm-th-orphans-0.13.11.drv' failed with exit code 137
cannot build derivation '/nix/store/6905vf3g22cgzmypgkdy463aq71si64q-haskell-src-meta-0.8.7.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/5s2k6qkj756vz3gcyf40nlzcz8ky9nb5-interpolate-0.2.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/pwhs71h6kz5wzndsn6jn08k8pw33c6vr-hpack-0.34.4.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/33rfrrz9v9dzr3lp0a1s5m2p49alnxwh-cabal2nix-2.18.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/wdqbi6d9pwrpry99i4h9fiawilm5pwvx-cabal2nix-obelisk-command.drv': 1 dependencies couldn't be built
error: build of '/nix/store/wdqbi6d9pwrpry99i4h9fiawilm5pwvx-cabal2nix-obelisk-command.drv' failed
(use '--show-trace' to show detailed location information)
@zlindenbaum do you know how much RAM is allocated to the VM? Exit code 137 means you are out of RAM. Might be worth a try to increase it if you can.
Just an update on this, the fix is very likely to bump nixpkgs in order to attain all the updates that have happened in Nixpkgs for dealing with Apple updates to M1 Macs.
This is being worked on right now so a solution should come through soon.
@zlindenbaum It is worth ensuring the binary caches are installed but this may or may not help.
you also may need to restart the nix-daemon in order for the nix.conf changes in the README.md to work
sudo systemctl restart nix-daemon
We are actively working on restoring M1 support through upgrading nixpkgs, which you can follow here
@augyg Should this be resolved now that branch has been merged?
@Sintrastes Apologies, I'm no longer actively involved with this and I cannot confirm if this issue is in fact solved by the branch being merged.
there is a possibility that this is connected to some of the other issues filed about installs on Mac OS, see https://github.com/obsidiansystems/obelisk/issues/895 which has recently come up for an install on dev's computer I was helping with yesterday.
Just tried to install Obelisk and Nix from scratch (no previous installations) and looks like this problem still persists on MacOS 12.6 M1
The following error being:
view error
error: cannot coerce null to a string
at /nix/store/yxa12wh8fc6j8w61y3jn27vw8dhydby7-source/pkgs/stdenv/generic/make-derivation.nix:192:34:
191| // (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) {
192| name = "${attrs.pname}-${attrs.version}";
| ^
193| } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) {
(use '--show-trace' to show detailed location information)
I'm having the same error as @Cmdv. MacOS 13.0.1 - Apple M1 Max. 😔
@rober-m is nix supported for Ventura yet? I tried that recently and got an unsupported system warning
in general if you’re coming across this thread I’d recommend either downgrading to big sur (ideally, ideally, ideally catalina) or getting a Ubuntu VM for now
Hi @augyg! Thank you for answering so fast! Yes, it is supported! I've been using it for a couple of weeks and haven't had any problems so far, but I'll follow your advice. Thank you again!
On a new M2 mac (ventura) with a working nix installation, obelisk's nix derivation is unable to build GHC:
nix-env -f https://github.com/obsidiansystems/obelisk/archive/master.tar.gz -iA command
trace: Warning: `stdenv.lib` is deprecated and will be removed in the next release. Please use `lib` instead. For more information see https://github.com/NixOS/nixpkgs/issues/108938
error:
… while evaluating the attribute 'obelisk-command'
at /nix/store/pgrb5z794d1v8c42a8r10i4gmy1j6xs4-source/haskell-overlays/tighten-ob-exes.nix:18:3:
17| # 0.5 seconds on a decent machine with SSD), so we do `justStaticExecutables`.
18| obelisk-command = haskellLib.overrideCabal
| ^
19| (haskellLib.generateOptparseApplicativeCompletion "ob"
… in the left operand of the update (//) operator
at /nix/store/fv90cbnl3q61a8zhxghzbimxgnk850hj-source/pkgs/development/haskell-modules/lib.nix:39:7:
38| mkDerivation = drv: (args.mkDerivation drv).override f;
39| })) // {
| ^
40| overrideScope = scope: overrideCabal (drv.overrideScope scope) f;
(stack trace truncated; use '--show-trace' to show the full trace)
error: Package ‘ghc-8.10.4’ in /nix/store/fv90cbnl3q61a8zhxghzbimxgnk850hj-source/pkgs/development/compilers/ghc/8.10.4.nix:263 is not supported on ‘aarch64-darwin’, refusing to evaluate.
a) To temporarily allow packages that are unsupported for this system, you can use an environment variable
for a single invocation of the nix tools.
$ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
b) For `nixos-rebuild` you can set
{ nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.
c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.
overriding the warning gives:
nix-env -f https://github.com/obsidiansystems/obelisk/archive/master.tar.gz -iA command
trace: Warning: `stdenv.lib` is deprecated and will be removed in the next release. Please use `lib` instead. For more information see https://github.com/NixOS/nixpkgs/issues/108938
error:
… while evaluating the attribute 'obelisk-command'
at /nix/store/pgrb5z794d1v8c42a8r10i4gmy1j6xs4-source/haskell-overlays/tighten-ob-exes.nix:18:3:
17| # 0.5 seconds on a decent machine with SSD), so we do `justStaticExecutables`.
18| obelisk-command = haskellLib.overrideCabal
| ^
19| (haskellLib.generateOptparseApplicativeCompletion "ob"
… in the left operand of the update (//) operator
at /nix/store/fv90cbnl3q61a8zhxghzbimxgnk850hj-source/pkgs/development/haskell-modules/lib.nix:39:7:
38| mkDerivation = drv: (args.mkDerivation drv).override f;
39| })) // {
| ^
40| overrideScope = scope: overrideCabal (drv.overrideScope scope) f;
(stack trace truncated; use '--show-trace' to show the full trace)
error: cannot bootstrap GHC on this platform
On a new M2 mac (ventura) with a working nix installation, obelisk's nix derivation is unable to build GHC:
nix-env -f https://github.com/obsidiansystems/obelisk/archive/master.tar.gz -iA command trace: Warning: `stdenv.lib` is deprecated and will be removed in the next release. Please use `lib` instead. For more information see https://github.com/NixOS/nixpkgs/issues/108938 error: … while evaluating the attribute 'obelisk-command' at /nix/store/pgrb5z794d1v8c42a8r10i4gmy1j6xs4-source/haskell-overlays/tighten-ob-exes.nix:18:3: 17| # 0.5 seconds on a decent machine with SSD), so we do `justStaticExecutables`. 18| obelisk-command = haskellLib.overrideCabal | ^ 19| (haskellLib.generateOptparseApplicativeCompletion "ob" … in the left operand of the update (//) operator at /nix/store/fv90cbnl3q61a8zhxghzbimxgnk850hj-source/pkgs/development/haskell-modules/lib.nix:39:7: 38| mkDerivation = drv: (args.mkDerivation drv).override f; 39| })) // { | ^ 40| overrideScope = scope: overrideCabal (drv.overrideScope scope) f; (stack trace truncated; use '--show-trace' to show the full trace) error: Package ‘ghc-8.10.4’ in /nix/store/fv90cbnl3q61a8zhxghzbimxgnk850hj-source/pkgs/development/compilers/ghc/8.10.4.nix:263 is not supported on ‘aarch64-darwin’, refusing to evaluate. a) To temporarily allow packages that are unsupported for this system, you can use an environment variable for a single invocation of the nix tools. $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 b) For `nixos-rebuild` you can set { nixpkgs.config.allowUnsupportedSystem = true; } in configuration.nix to override this. c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add { allowUnsupportedSystem = true; } to ~/.config/nixpkgs/config.nix.
overriding the warning gives:
nix-env -f https://github.com/obsidiansystems/obelisk/archive/master.tar.gz -iA command trace: Warning: `stdenv.lib` is deprecated and will be removed in the next release. Please use `lib` instead. For more information see https://github.com/NixOS/nixpkgs/issues/108938 error: … while evaluating the attribute 'obelisk-command' at /nix/store/pgrb5z794d1v8c42a8r10i4gmy1j6xs4-source/haskell-overlays/tighten-ob-exes.nix:18:3: 17| # 0.5 seconds on a decent machine with SSD), so we do `justStaticExecutables`. 18| obelisk-command = haskellLib.overrideCabal | ^ 19| (haskellLib.generateOptparseApplicativeCompletion "ob" … in the left operand of the update (//) operator at /nix/store/fv90cbnl3q61a8zhxghzbimxgnk850hj-source/pkgs/development/haskell-modules/lib.nix:39:7: 38| mkDerivation = drv: (args.mkDerivation drv).override f; 39| })) // { | ^ 40| overrideScope = scope: overrideCabal (drv.overrideScope scope) f; (stack trace truncated; use '--show-trace' to show the full trace) error: cannot bootstrap GHC on this platform
Same here on my M1 machine.
Could you try using this branch: https://github.com/obsidiansystems/obelisk/tree/aa/aarch64-darwin
Could you try using this branch: https://github.com/obsidiansystems/obelisk/tree/aa/aarch64-darwin
This is based on the in-progress reflex-platform branch which adds support for aarch64 linux and darwin hosts. See the platform support doc
https://github.com/obsidiansystems/obelisk/tree/aa/aarch64-darwin
Builds the shell for me on an M2 Max. Have yet to bring our project up to speed with the package set changes yet, so cannot confirm anything besides the shell.
Support is being added in #1046, which will be merged as soon as the tests pass.
Fixed in 1.3