Skip to main content

Reflex Tutorial Upgrade (Part 3)

My third attempt to update the Reflex FRP calculator tutorial to use the latest release of Obelisk, using a multi-user Nix installation, failed just like the first two attempts. I was unable to see the actual error due to the ob --verbose issue, making it difficult to make progress. Today, I tried again!

Obelisk provides great instructions for hacking on Obelisk from within an Obelisk project! I was able to start hacking on it without any issues and quickly traced the cause of the “invalid character” failure that occurs when running ob --verbose run. See my issue comment for details. Replacing some Unicode characters with some ASCII characters allowed me to get past the issue.

Using --verbose, I was finally able to see the error that was causing my build to fail.

error: file 'nixpkgs' was not found in the Nix search path (add it using
$NIX_PATH or -I), at
/nix/store/ff2cwrd6mflr9mnj5r209gr8mpyaq3qj-source/haskell-overlays/hnix/hnix/thunk.nix:5:18

I did not use a NIX_PATH environment variable in the single-user environment, but perhaps it is required in a multi-user environment. I tried setting it as follows.

$ export NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs"

Trying again, the build proceeded for quite some time before it eventually failed with the following error (reformatted).

error:
  builder for '/nix/store/74bnh961xzdfdjn9fqc3wg1l31z2gk09-mmark-0.0.7.1.drv'
  failed with exit code 1;
last 10 log lines:
> die', called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:950
    :20 in Cabal-2.4.0.1:Distribution.Simple.Configure
> configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/
    Simple/Configure.hs:460:12 in Cabal-2.4.0.1:Distribution.Simple.Configure
> configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:596:20 in
    Cabal-2.4.0.1:Distribution.Simple
> confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs
    :67:5 in Cabal-2.4.0.1:Distribution.Simple.UserHooks
> configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:178
    :19 in Cabal-2.4.0.1:Distribution.Simple
> defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs
    :115:27 in Cabal-2.4.0.1:Distribution.Simple
> defaultMain, called at Setup.hs:6:8 in main:Main
> Setup: Encountered missing dependencies:
> megaparsec >=7.0 && <8.0
>
For full logs, run
  'nix log /nix/store/74bnh961xzdfdjn9fqc3wg1l31z2gk09-mmark-0.0.7.1.drv'.
error: error: 1 dependencies of derivation
  '/nix/store/l47hy00n8hj47v8vh1rmq3x8j58kpw74-ghc-8.6.5-with-packages.drv'
  failed to build

Running the suggested command resulted in the following error.

error: experimental Nix feature 'nix-command' is disabled; use
  '--extra-experimental-features nix-command' to override

Thanks, Nix. I ran the following command, which gave me the full logs. I am removing the call stack since it is the same as above.

$ nix --extra-experimental-features nix-command log \
    /nix/store/74bnh961xzdfdjn9fqc3wg1l31z2gk09-mmark-0.0.7.1.drv
@nix { "action": "setPhase", "phase": "setupCompilerEnvironmentPhase" }
setupCompilerEnvironmentPhase
Build with /nix/store/jc9zqp241vz5ziwh0smls0sl1sf6h7np-ghc-8.6.5.
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/2j790sjzmwmx559br369454wmciyvk5v-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "compileBuildDriverPhase" }
compileBuildDriverPhase
setupCompileFlags: -package-db=/build/setup-package.conf.d -j16 +RTS -A64M
  -RTS -threaded -rtsopts
[1 of 1] Compiling Main             ( Setup.hs, /build/Main.o )
Linking Setup ...
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
configureFlags: --verbose
  --prefix=/nix/store/0kwh27qz28gbghqs1vd4gwbwmwfcyyvs-mmark-0.0.7.1
  --libdir=$p>
Using Parsec parser
Configuring mmark-0.0.7.1...
CallStack (from HasCallStack):
  ...
Setup: Encountered missing dependencies:
megaparsec >=7.0 && <8.0

I wonder if this failure is related to my NIX_PATH, which specifies an arbitrary revision of nixpkgs… I wonder why the build is using NIX_PATH at all, as a nixpkgs revision is specified by Reflex Platform, which is determined by the Obelisk version.

I have made some progress, but that is all the time that I have for this today.