Nix: Remove the build hook mechanism

Created on 7 Feb 2017  路  10Comments  路  Source: NixOS/nix

Like the substituter mechanism, we can use the Store abstraction instead. I.e. we call remoteStore->buildPaths(...) directly rather than calling an external process that does the same thing.

improvement

Most helpful comment

You're right, it requires a trusted user. We could require the untrusted user's builders to be a subset of the daemons builders though.

All 10 comments

Would this just be an internal change to Nix? If not, how would this affect those of us who are using NIX_BUILD_HOOK with things other than build-remote.pl?

It would break your build hook. What are you using NIX_BUILD_HOOK for?

I'm using NIX_BUILD_HOOK with nix-instantiate and nix-store --realise in order to easily get machine readable output of the build in progress. By using a build hook with these tools I can have precise control over what's being built when, and the output of the builder.

It's also been useful in getting some better --dry-run functionality as described here too.

@expipiplus1
Which entity executes NIX_BUILD_HOOK in your scenario? I'm asking because both nix-build and nix-store -r will try to lock the output path, so you can't have one just call another.

EDIT: seems like NIX_HELD_LOCKS is the mechanism for this, but it is ignored by nix-store -r.

Would doing this prevent implementation of use cases like https://github.com/NixOS/nix/issues/1914?

@ledettwy No, it shouldn't affect that.

@volth You can force a local build by passing --builders ''.

You're right, it requires a trusted user. We could require the untrusted user's builders to be a subset of the daemons builders though.

I'm using build hooks to incrementally push things to the cache (as opposed to only after a full derivation built). Is there a better mechanism for doing this?

Nevermind. I'm using post-build hooks. sorry

Was this page helpful?
0 / 5 - 0 ratings