IHP 1.3 is out now!

Build with nix fails after update to v1.1

Gergely Szabo

I just updated my app to IHP v1.1, everything went smoothly, I can run the development server without any issue. However, when I try to run nix-build or nix build, I get errors (I'm not sure which is the correct command at the moment, with flakes it should be nix build, but the documentation still says nix-build, with hyphen). The error message I get with nix-build:

error:
       … while calling the 'derivationStrict' builtin

         at //builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'app'
         whose name attribute is located at /nix/store/4jh9cp71v65rxlx9yk3lgp4g1x0nw7i5-source/pkgs/stdenv/generic/make-derivation.nix:302:7

       … while evaluating attribute 'buildInputs' of derivation 'app'

         at /nix/store/4jh9cp71v65rxlx9yk3lgp4g1x0nw7i5-source/pkgs/stdenv/generic/make-derivation.nix:345:7:

          344|       depsHostHost                = lib.elemAt (lib.elemAt dependencies 1) 0;
          345|       buildInputs                 = lib.elemAt (lib.elemAt dependencies 1) 1;
             |       ^
          346|       depsTargetTarget            = lib.elemAt (lib.elemAt dependencies 2) 0;

       error: cannot compare a set with a string with context

with nix build I got some error:

error:
       … while evaluating the attribute 'optionalValue.value'

         at /nix/store/3i5iasvc4035gna928p7iwnmv8nify1k-source/lib/modules.nix:806:5:

          805|
          806|     optionalValue =
             |     ^
          807|       if isDefined then { value = mergedValue; }

       … while evaluating a branch condition

         at /nix/store/3i5iasvc4035gna928p7iwnmv8nify1k-source/lib/modules.nix:807:7:

          806|     optionalValue =
          807|       if isDefined then { value = mergedValue; }
             |       ^
          808|       else {};

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: cannot look up '<nixpkgs>' in pure evaluation mode (use '--impure' to override)

       at «none»:0: (source not available)

I ended up using nix build --impure, but I'd prefer a pure solution

marc PRO

The error message I get with nix-build

Is there a flake.lock file in your project? And is it committed to git? Without the lock file, using nix-build without flakes will fail.

I ended up using nix build --impure, but I'd prefer a pure solution

This has been fixed already on the master branch of IHP. So pure builds are available with the next release (or if you don't want to wait, you can upgrade to master right away)