I am trying to build a package locally on my system using nixpkgs. I need to figure out the following ways to make it easier and faster (where the package build time is longer) to develop nix packages which are not available on nixpkgs repo yet.
- How to build in incremental fashion using nix repl.
- How to disable the deletion of /tmp/nix/build/repository to debug issues.
- I am getting the package built but it ignore few of the options.
- Also, where the nix saves the build log (I surely can pipe it to a file).
You can use
--keep-failed to keep the build directory in case of a failed build. It’s printed at the end. The log is in there, too, I think.
To build it incrementally, you can enter the
nix-shell and start the build with
genericBuild. Or you can run the phases manually, e.g. unpackPhase, configurePhase, buildPhase.
Please refer to the wiki for more details.
Thanks John. I was looking for primarily the --keep-failed. Does garbage-collect remove these failed ones?
I’m pretty sure the garbage collect doesn’t clean up /temp, no.
Actually, I am facing a problem where the build is successful but not with the right options passed. The keep-failed does not help me. And the store only contains the final build output. I want to keep the /tmp/nix/package/build/dir and also the log even for successful builds.
Was running the stages manually in a nix shell useful to you?
Otherwise you can also try the
breakpointHook documented in the manual.