target / lorri

Your project's nix-env

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Equivalent of --max-jobs 0?

nomeata opened this issue · comments

I noticed that with lorri I am always a bit worried that I do something wrong, or my network goes down, and suddenly lorri will heat my my laptop to build rustc or something like that, instead of fetching it from a cache.

So I am wondering: Is there a supported and reliable way to get lorri into a state where it will never let nix build stuff locally: Either fetch everything needed for the shell from a cache, or fail the build.

Is this somehting that crossed your mind? How would I do that?

So I am wondering: Is there a supported and reliable way to get lorri into a state where it will never let nix build stuff locally: Either fetch everything needed for the shell from a cache, or fail the build.

This sounds like a good candidate for a specific feature-flag in lorri.

It would pass --builders '' and --max-jobs 0 to the nix build, but we should kind of make sure the error messages that lorri gives are nice.

As far as implementation goes, I’d translate the flag to

/// These options correspond to the nix options in `man nix.conf`
/// with the same names, though we only support a subset.
///
/// You can use `.append(other)` to merge another `NixOptions`.
#[derive(Clone)]
pub struct NixOptions {
/// List of nix `builder` specifications
///
/// * `None` use the ones configured in the nix config
/// * `Some([])`: use no builders
/// * `Some(list)`: use exactly `list`
pub builders: Option<Vec<String>>,
/// `substituter` hostnames
///
/// * `None`: use the ones configured in the nix config
/// * `Some([])`: use no substituters
/// *`Some(list)`: use exactly `list`
pub substituters: Option<Vec<String>>,
}

(needs a new struct field for max-jobs).

Maybe even add a provenance thingy to the nix options merge, so that if user sets conflicting flags there is a way to error out (or if there’s redundant flags there is a way to notify). Though I would say that is optional/orthogonal.