Help packaging: Accessing license-server during build


I have a compiler which requires a license-server to be accessible so it can work. To be clear, I have packaged the compiler successfully, this is about shipping libraries produced by that compiler.

Doing this has two problems: (1) requiring an environment variable LICENSE_FILE=port@server which I don’t want in the package, and (2) having the network connection to access it.

  1. I can kind-of bypass by having the environment variable be part of the package source, but I would rather use something like “impureEnvVars”, which I see are only for fixed-output derivations, whereas here I am trying to package a library.

  2. Even when setting the environment variable, it is unable to access the license server. I believe networking is turned off for non-fixed-output derivations?

Any suggestions?


The easiest option is to set __noChroot = true; on your derivation. This will completely turn off the sandbox for that derivation and allow it to access both the whole filesystem and network (as a nixbld user). You will also have to set sandbox = relaxed in your /etc/nix/nix.conf file and make sure that the nix-daemon has been restarted.