nix-installer icon indicating copy to clipboard operation
nix-installer copied to clipboard

/nix/determinate/post-build-hook.sh does not exist

Open Yappaholic opened this issue 11 months ago • 15 comments

I was trying to use home-manager after installing nix with determinate nix-installer and I got this error when switching home-manager profile. I did try it on different musl-based systems(Alpine, Gentoo and Void), still getting the same error.

Yappaholic avatar Feb 17 '25 13:02 Yappaholic

How did you install Nix (i.e. what flags, if any, did you pass to the installer)?

What version are you using?

Are there any errors in the logs of nix-daemon.service (journalctl -eu nix-daemon.service)?

cole-h avatar Feb 17 '25 20:02 cole-h

How did you install Nix (i.e. what flags, if any, did you pass to the installer)?

What version are you using?

Are there any errors in the logs of nix-daemon.service (journalctl -eu nix-daemon.service)?

I was using the latest version(0.36.4 if I'm correct) and passed install Linux --init none as parameters for the installer. I did not use the systemd service because all the distributions I used were RC based (RC, OpenRC) and I wrote custom services with nix-daemon.

Yappaholic avatar Feb 18 '25 13:02 Yappaholic

That's interesting, because the post-build-hook setting should only be configured if you passed the --determinate flag during installation. Can you confirm whether or not you did that (or maybe did that in the past)?

If you did indeed pass that flag and do still want Determinate Nix, you'll want to write a custom service that executes determinate-nixd, which handles starting the nix-daemon itself. Part of its startup process is creating that post-build-hook.sh file. You can use the systemd unit for reference in this case.

If you did not intend to install Determinate Nix, then you can freely remove that setting from nix.conf, which should fix the issue you're seeing.

cole-h avatar Feb 18 '25 15:02 cole-h

That's interesting, because the post-build-hook setting should only be configured if you passed the --determinate flag during installation. Can you confirm whether or not you did that (or maybe did that in the past)?

I didn't use the --determinate flag, though I got both nix and determinate-nixd, so maybe that's the cause for not having post-build-hook.

If you did indeed pass that flag and do still want Determinate Nix, you'll want to write a custom service that executes determinate-nixd, which handles starting the nix-daemon itself. Part of its startup process is creating that post-build-hook.sh file. You can use the systemd unit for reference in this case.

I did write a custom service that executed nix-daemon --daemon according to this guide

Yappaholic avatar Feb 18 '25 16:02 Yappaholic

I also have this problem. I installed with:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \
  sh -s -- install --determinate

Running the following results in this error:

nix profile install github:guibou/nixGL --impure                                   
error:
       … while evaluating the attribute 'auto.nixGLDefault'
         at /nix/store/wnf3rly6jbw4ywqhzgn0vl6lk8hwgkg3-source/nixGL.nix:243:7:
          242|       # nixGLNvidia or nixGLIntel using an heuristic.
          243|       nixGLDefault = if nvidiaVersionAuto != null then
             |       ^
          244|         nixGLCommon autoNvidia.nixGLNvidia

       … while evaluating a branch condition
         at /nix/store/wnf3rly6jbw4ywqhzgn0vl6lk8hwgkg3-source/nixGL.nix:243:22:
          242|       # nixGLNvidia or nixGLIntel using an heuristic.
          243|       nixGLDefault = if nvidiaVersionAuto != null then
             |                      ^
          244|         nixGLCommon autoNvidia.nixGLNvidia

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

       error: program '/nix/var/determinate/post-build-hook.sh' failed with exit code 1

There is no determinate directory in /nix/var:

ls -l /nix/var 
total 0
drwxr-xr-x. 1 root root   6 Feb 27 09:15 log
drwxr-xr-x. 1 root root 108 Feb 27 09:15 nix

The nix-daemon is running:

sudo systemctl status nix-daemon

● nix-daemon.service - Nix Daemon
     Loaded: loaded (/etc/systemd/system/nix-daemon.service; linked; preset: disabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf, 50-keep-warm.conf
     Active: active (running) since Thu 2025-02-27 09:16:14 CET; 4min 35s ago
 Invocation: e64b8c9c9b8340eba3a8139074879835
TriggeredBy: ● nix-daemon.socket
       Docs: man:nix-daemon
             https://nixos.org/manual
   Main PID: 13607 (nix-daemon)
      Tasks: 2 (limit: 1048576)
     Memory: 1.9G (peak: 1.9G)
        CPU: 23.627s
     CGroup: /system.slice/nix-daemon.service
             └─13607 nix-daemon --daemon

Feb 27 09:16:14 bluefin systemd[1]: Started nix-daemon.service - Nix Daemon.
Feb 27 09:16:14 bluefin nix-daemon[13607]: accepted connection from pid 13604, user tanc
Feb 27 09:16:52 bluefin nix-daemon[13607]: accepted connection from pid 14772, user tanc

Any ideas?

tanc avatar Feb 27 '25 08:02 tanc

determinate-nixd is installed, trying to upgrade it results in:

sudo determinate-nixd upgrade
upgrading Nix in profile "/nix/var/nix/profiles/default"
querying latest Nix version...
downloading '/nix/store/3smvdkzf2pdc85m5k5qljfsbdcpp0c0f-nix-2.26.2'......
copying path '/nix/store/xqk8b9ay8vsh28s4dn6j8x603ymjz55m-nix-manual-2.26.2-man' from 'https://cache.nixos.org'...
copying path '/nix/store/3smvdkzf2pdc85m5k5qljfsbdcpp0c0f-nix-2.26.2' from 'https://cache.nixos.org'...
verifying that '/nix/store/3smvdkzf2pdc85m5k5qljfsbdcpp0c0f-nix-2.26.2' works......
installing '/nix/store/3smvdkzf2pdc85m5k5qljfsbdcpp0c0f-nix-2.26.2' into profile "/nix/var/nix/profiles/default"......
replacing old 'nix-2.26.2'
installing 'nix-2.26.2'
building '/nix/store/sacsngmhlj19a2cf3ca9aq3zm8858sxm-user-environment.drv'...
post-build-hook: error: executing '/nix/var/determinate/post-build-hook.sh': No such file or directory
error: program '/nix/var/determinate/post-build-hook.sh' failed with exit code 1
error: program '/nix/store/ni2gvlli2qliadpdinvqvarf89jyi291-nix-2.26.2/bin/nix-env' failed with exit code 1
Error: Nix upgrade command `"/nix/var/nix/profiles/default/bin/nix" "upgrade-nix" "--verbose" "--nix-store-paths-url" "https://install.determinate.systems/nix-upgrade/stable/universal" "--profile" "/nix/var/nix/profiles/default"` failed, code: Some(1)

Location:
    src/command/upgrade.rs:80:13

This is my first time trying to use nix and the determinate version so I'm fairly confused.

tanc avatar Feb 27 '25 08:02 tanc

determinate-nixd is installed, trying to upgrade it results in:

sudo determinate-nixd upgrade
upgrading Nix in profile "/nix/var/nix/profiles/default"
querying latest Nix version...
downloading '/nix/store/3smvdkzf2pdc85m5k5qljfsbdcpp0c0f-nix-2.26.2'......
copying path '/nix/store/xqk8b9ay8vsh28s4dn6j8x603ymjz55m-nix-manual-2.26.2-man' from 'https://cache.nixos.org'...
copying path '/nix/store/3smvdkzf2pdc85m5k5qljfsbdcpp0c0f-nix-2.26.2' from 'https://cache.nixos.org'...
verifying that '/nix/store/3smvdkzf2pdc85m5k5qljfsbdcpp0c0f-nix-2.26.2' works......
installing '/nix/store/3smvdkzf2pdc85m5k5qljfsbdcpp0c0f-nix-2.26.2' into profile "/nix/var/nix/profiles/default"......
replacing old 'nix-2.26.2'
installing 'nix-2.26.2'
building '/nix/store/sacsngmhlj19a2cf3ca9aq3zm8858sxm-user-environment.drv'...
post-build-hook: error: executing '/nix/var/determinate/post-build-hook.sh': No such file or directory
error: program '/nix/var/determinate/post-build-hook.sh' failed with exit code 1
error: program '/nix/store/ni2gvlli2qliadpdinvqvarf89jyi291-nix-2.26.2/bin/nix-env' failed with exit code 1
Error: Nix upgrade command `"/nix/var/nix/profiles/default/bin/nix" "upgrade-nix" "--verbose" "--nix-store-paths-url" "https://install.determinate.systems/nix-upgrade/stable/universal" "--profile" "/nix/var/nix/profiles/default"` failed, code: Some(1)

Location:
    src/command/upgrade.rs:80:13

This is my first time trying to use nix and the determinate version so I'm fairly confused.

What distribution and libc do you use?

Yappaholic avatar Feb 27 '25 15:02 Yappaholic

Distro: Bluefin (Version: 41.20250223.1 / FROM Fedora Silverblue 41) libc: ldd (GNU libc) 2.40

tanc avatar Feb 27 '25 15:02 tanc

Distro: Bluefin (Version: 41.20250223.1 / FROM Fedora Silverblue 41) libc: ldd (GNU libc) 2.40

Never heard of it. Does it use systemd or another service manager like OpenRC?

Yappaholic avatar Feb 27 '25 15:02 Yappaholic

Its a variant of Fedora Silverblue which is a well know distro. It uses systemd and has an immutable filesystem. See https://fedoraproject.org/atomic-desktops/silverblue/

tanc avatar Feb 27 '25 15:02 tanc

It uses systemd and has an immutable filesystem.

That's interesting, because I thought that the problem existed due to me using anything but systemd with determinate-nixd. Did you try to run determinate-nixd init? It should mount /nix/var/determinate

Yappaholic avatar Feb 27 '25 16:02 Yappaholic

➜ determinate-nixd init

~ …
➜ nix profile install github:guibou/nixGL --impure
error:
       … while evaluating the attribute 'auto.nixGLDefault'
         at /nix/store/wnf3rly6jbw4ywqhzgn0vl6lk8hwgkg3-source/nixGL.nix:243:7:
          242|       # nixGLNvidia or nixGLIntel using an heuristic.
          243|       nixGLDefault = if nvidiaVersionAuto != null then
             |       ^
          244|         nixGLCommon autoNvidia.nixGLNvidia

       … while evaluating a branch condition
         at /nix/store/wnf3rly6jbw4ywqhzgn0vl6lk8hwgkg3-source/nixGL.nix:243:22:
          242|       # nixGLNvidia or nixGLIntel using an heuristic.
          243|       nixGLDefault = if nvidiaVersionAuto != null then
             |                      ^
          244|         nixGLCommon autoNvidia.nixGLNvidia

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

       error: program '/nix/var/determinate/post-build-hook.sh' failed with exit code 1

Unfortunately the same issue.

~ …
➜ ls -la /nix/var 
total 0
drwxr-xr-x. 1 root root  12 Feb 27 09:15 .
drwxr-xr-x. 1 root root  66 Feb 27 09:15 ..
drwxr-xr-x. 1 root root   6 Feb 27 09:15 log
drwxr-xr-x. 1 root root 108 Feb 27 09:15 nix

tanc avatar Feb 27 '25 16:02 tanc

➜ determinate-nixd init

~ …
➜ nix profile install github:guibou/nixGL --impure
error:
       … while evaluating the attribute 'auto.nixGLDefault'
         at /nix/store/wnf3rly6jbw4ywqhzgn0vl6lk8hwgkg3-source/nixGL.nix:243:7:
          242|       # nixGLNvidia or nixGLIntel using an heuristic.
          243|       nixGLDefault = if nvidiaVersionAuto != null then
             |       ^
          244|         nixGLCommon autoNvidia.nixGLNvidia

       … while evaluating a branch condition
         at /nix/store/wnf3rly6jbw4ywqhzgn0vl6lk8hwgkg3-source/nixGL.nix:243:22:
          242|       # nixGLNvidia or nixGLIntel using an heuristic.
          243|       nixGLDefault = if nvidiaVersionAuto != null then
             |                      ^
          244|         nixGLCommon autoNvidia.nixGLNvidia

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

       error: program '/nix/var/determinate/post-build-hook.sh' failed with exit code 1

Unfortunately the same issue.

~ …
➜ ls -la /nix/var 
total 0
drwxr-xr-x. 1 root root  12 Feb 27 09:15 .
drwxr-xr-x. 1 root root  66 Feb 27 09:15 ..
drwxr-xr-x. 1 root root   6 Feb 27 09:15 log
drwxr-xr-x. 1 root root 108 Feb 27 09:15 nix

Well, I can't help but suggest to uninstall determinate-nix and install nix from the official NixOS installer, nix will work this way (at least it worked for me).

Yappaholic avatar Feb 27 '25 16:02 Yappaholic

I tried uninstalling and then installing nix but:

➜ sh <(curl -L https://nixos.org/nix/install) --daemon
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100  4267  100  4267    0     0   1802      0  0:00:02  0:00:02 --:--:-- 11819
downloading Nix 2.26.2 binary tarball for x86_64-linux from 'https://releases.nixos.org/nix/nix-2.26.2/nix-2.26.2-x86_64-linux.tar.xz' to '/tmp/nix-binary-tarball-unpack.Zjqv4U6JNf'...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 22.6M  100 22.6M    0     0  3130k      0  0:00:07  0:00:07 --:--:-- 4420k
Note: a multi-user installation is possible. See https://nixos.org/manual/nix/stable/installation/installing-binary.html#multi-user-installation
Switching to the Multi-user Installer

---- oh no! --------------------------------------------------------------------
Nix does not work with selinux enabled yet!
see https://github.com/NixOS/nix/issues/2374

I guess I'll give up on nix for a while

tanc avatar Feb 27 '25 16:02 tanc

---- oh no! --------------------------------------------------------------------
Nix does not work with selinux enabled yet!
see https://github.com/NixOS/nix/issues/2374

Well, now that makes sense. Then yea, unfortunately nix is not available for you.

Yappaholic avatar Feb 27 '25 16:02 Yappaholic