Skip to main content

Reflex Tutorial Upgrade (Part 2)

I have tried to update the Reflex FRP calculator tutorial to use the latest release of Obelisk twice. Both attempts failed, and I have not been able to see the actual error due to the ob --verbose issue. See the Reflex Package Versions and Reflex Tutorial Upgrade blog entries for details. I am not sure if the Nix cache is being used, however, and the build may succeed if cache is used. Now that I have a working Multi-User Nix Installation, I will try again!

I configured /etc/nix/nix.conf as described in Installing Obelisk. With multi-user Nix, this file already exists, so I am more confident that it is actually used. I then ran the following command, as before.

$ nix-env -f https://github.com/obsidiansystems/obelisk/archive/master.tar.gz -iA command

This time it was building GHC!?!?

...
Configure completed successfully.

   Building GHC version  : 8.6.5
          Git commit id  : 92b6a0237e0195cee4773de4b237951addd659d9
...

It did not build GHC when using single-user mode, and I confirmed that there have not been any new commits to the master branch of the obelisk repository. Letting GHC build, I tried to think of what I could possibly do to resolve the issue. I eventually had an idea, aborted the build, and ran nix-collect-garbage -d to clean the Nix store.

In the Installing Obelisk instructions, it instructs macOS users to restart the Nix daemon using launchctl. There are no corresponding instructions for Linux users, but perhaps the daemon needs to be restarted on Linux as well…

$ sudo systemctl restart nix-daemon.service
$ sudo systemctl status nix-daemon.service
● nix-daemon.service - Nix Daemon
     Loaded: loaded (/etc/systemd/system/nix-daemon.service; linked; vendor preset: disabled)
     Active: active (running) since Wed 2022-04-06 10:13:09 JST; 33s ago
TriggeredBy: ● nix-daemon.socket
   Main PID: 375375 (nix-daemon)
      Tasks: 17 (limit: 14113)
     Memory: 4.3M
        CPU: 14ms
     CGroup: /system.slice/nix-daemon.service
             └─375375 nix-daemon --daemon

 4月 06 10:13:09 exponential systemd[1]: Started Nix Daemon.

I ran the command again, and it installs without building GHC. The restart of the Nix daemon is required to take into account the new cache settings.

$ nix-env -f https://github.com/obsidiansystems/obelisk/archive/master.tar.gz -iA command

During installation, I noticed that many paths are copied from https://nixcache.reflex-frp.org. Checking my single-user install, I confirmed that it also copies paths from this source, indicating that /etc/nix/nix.conf is being used in that case as well. (I did not think of checking this before because ob run shows no output. I checked now by removing Obelisk and reinstalling it.)

I created a fresh clone of the tutorial repository, used ob thunk update to update .obelisk/impl, and then ran ob run.

$ cd /tmp
$ git clone https://github.com/obsidiansystems/calculator-tutorial.git
$ cd calculator-tutorial
$ ob --no-handoff thunk update .obelisk/impl --branch master
$ ob run

The build failed with the same error message after just over forty minutes. (The system I ran the test on is faster than my daily driver.) I confirmed that the ob --verbose issue is present on this system, so I am still unable to see the actual error. Whatever it is, it is not resolved by using cache.