4 ms·
>`nix build` command disables network access Only if building with sandbox enabled. Can disable it if network access is required. Seems someone opened an issue
by forgotpwd16 2y ago
>`nix build` command disables network access
Only if building with sandbox enabled. Can disable it if network access is required. Seems someone opened an issue asking[1] for granular permissions (explicit network restriction) but has been marked as stale. In same issue someone else has made comment providing an hybrid approach.
Since you mentioned Julia, it's possible to build Julia environments (with arbitrary packages) using the `.withPackages` function. E.g. `julia.withPackages ["Plots"]`.
[1]: https://github.com/NixOS/nix/issues/4584 https://github.com/NixOS/nix/issues/4584
- tombert 2y agoI didn’t realize that. I will give that a look.
- Filligree 2y agoInstead of disabling it completely, you can set it to 'relaxed'. That still allows network access, but maintains the other isolation guarantees. Obviously this introduces a potential impurity. I use it for installing NeoForge into a minecraft server derivation; the downloaded files could change behind my back, but so long as the version doesn't change it should still be compatible. It hasn't yet caused trouble. NixOS has a lot of escape hatches once you look around, and you shouldn't be afraid to use them. The downside of impure derivations aren't quite as bad as not-using-derivations, anyway. Another option is to declare it as a fixed-output derivation, in which case network access is enabled by default. This doesn't work for most installers, though; at a minimum you'll need to delete logfiles that might contain timestamps.