Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the build hook mechanism #1221

Open
edolstra opened this issue Feb 7, 2017 · 17 comments
Open

Remove the build hook mechanism #1221

edolstra opened this issue Feb 7, 2017 · 17 comments
Labels
contributor-experience Developer experience for Nix contributors derivation-build The process of building an individual derivation (see also sandbox label)

Comments

@edolstra
Copy link
Member

edolstra commented Feb 7, 2017

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.

@edolstra edolstra self-assigned this Feb 7, 2017
@expipiplus1
Copy link
Contributor

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?

@edolstra
Copy link
Member Author

edolstra commented Feb 9, 2017

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

@expipiplus1
Copy link
Contributor

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.

@veprbl
Copy link
Member

veprbl commented May 14, 2017

@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.

@LisannaAtHome
Copy link

Would doing this prevent implementation of use cases like #1914?

@edolstra
Copy link
Member Author

@ledettwy No, it shouldn't affect that.

@edolstra
Copy link
Member Author

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

edolstra referenced this issue Mar 21, 2018
E.g.

  cannot build on 'ssh://mac1': cannot connect to 'mac1': bash: nix-store: command not found
  cannot build on 'ssh://mac2': cannot connect to 'mac2': Host key verification failed.
  cannot build on 'ssh://mac3': cannot connect to 'mac3': Received disconnect from 213... port 6001:2: Too many authentication failures
  Authentication failed.
@edolstra
Copy link
Member Author

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.

@arianvp
Copy link
Member

arianvp commented Mar 27, 2020

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?

@arianvp
Copy link
Member

arianvp commented Mar 27, 2020

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

@stale
Copy link

stale bot commented Feb 16, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 16, 2021
@stale
Copy link

stale bot commented Apr 29, 2022

I closed this issue due to inactivity. → More info

@stale stale bot closed this as completed Apr 29, 2022
@edolstra edolstra reopened this Feb 2, 2023
@stale stale bot removed the stale label Feb 2, 2023
@Ericson2314
Copy link
Member

I have wondered whether as part of a migration we could have a build-hook:// store too.

@edolstra
Copy link
Member Author

edolstra commented Feb 3, 2023

Nix team discussion: The consensus is that we want to get rid of the build hook. There may be some issues around derivation cancellation, but that's not a big problem right now.

As a first step, we could remove the build-hook setting.

@domenkozar
Copy link
Member

Is there an alternative? This will break many existing CI setups.

@Ericson2314
Copy link
Member

Ericson2314 commented Feb 3, 2023

Alternative to which part? Overriding the build hook?

If that is in wide use, then yes we'll have to approach this the other way of doing a remoteBuildersNg (haskellPackagsNg, I remember you!) and then migrating people over to it, and then getting rid of the old build-hook way.

My comment about about a "build-hook:// store" would just serve to de-dup code during the deprecation period.

roberth added a commit to roberth/nix that referenced this issue Apr 7, 2024
Like always declining; local builds only, as can be inferred from the
docs. (Not worth spending too many words on this pretty obvious
behavior, I think. Also, plans to remove it? NixOS#1221)

(cherry picked from commit 3edd3001f45397ebc535d82d8fd9f798b4b0ab5f)
roberth added a commit to roberth/nix that referenced this issue Apr 11, 2024
Like always declining; local builds only, as can be inferred from the
docs. (Not worth spending too many words on this pretty obvious
behavior, I think. Also, plans to remove it? NixOS#1221)
@edolstra edolstra removed their assignment Apr 26, 2024
@roberth roberth added contributor-experience Developer experience for Nix contributors derivation-build The process of building an individual derivation (see also sandbox label) labels Jul 11, 2024
@L-as
Copy link
Member

L-as commented Jul 29, 2024

What is the point in removing it if it's e.g. only 100 lines of code to maintain?

I still do think remote building shouldn't go through the hook, but the hook might still be useful to keep around (for CI, as noted above).

OTOH, wouldn't the C API be a suitable replacement too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor-experience Developer experience for Nix contributors derivation-build The process of building an individual derivation (see also sandbox label)
Projects
None yet
Development

No branches or pull requests

11 participants