Any way to prevent local compilation?

Lately started to get haunted by hydra failures. (Relevant thread)

Today my laptop was levitating again due to fans. It was again thunderbird.

Is there a way to prevent local build? At least for certain packages? I realize that’s an odd question, but I’d rather see a nixos-rebuild to fail then compiling some of the apps I have.

1 Like

Maybe try --max-jobs 0 with a remote builder.

Another possibility is using nixus or deploy-rs from another computer and deploy the result to your laptop. Here’s my config GitHub - bbigras/nix-config: My personal nix config . 3 days a week a github action updates my packages with niv, builds the config for multiple computers and pushes it to cachix so I don’t have to build anything on my computers.

2 Likes

Is it possible to specify max-jobs in conjunction with autoUpgrade though?

I’m not 100% sure but I think so. You can set nix.maxJobs = 0; in configuration.nix.

I used it before to avoid using too many resources on an important system.

:warning I tried this now and it turned out to be a very bad idea. Once you switched to that and nix-channel --updated, you cannot go back that easily, because it also prevents you from building a configuration without nixos.maxJobs = 0 (obviously).

1 Like

You can just run nixos-rebuild boot -j 1 or any similar nix-build command with the -j X option to allow local builds again.

2 Likes

Unfortunately -j X doesn’t seem to be combinable with --upgrade:

# nixos-rebuild boot -j 1 --upgrade
unpacking channels...
error: 1 derivations need to be built, but neither local builds ('--max-jobs') nor remote builds ('--builders') are enabled
error: program '/nix/store/agzmb1cin5dn8wlbfmkbbjzvz4422yys-nix-2.3.9/bin/nix-env' failed with exit code 1

Works for me:

# nixos-rebuild boot --upgrade -j1 --builders ''
unpacking channels...
created 1 symlinks in user environment
building Nix...
building the system configuration...
these derivations will be built:
  /nix/store/j3ccp5lyzbcw9aziqjs6kc589y218l3r-nixos-version.drv
  /nix/store/rd8fxmag28ybiqwbmk17l9ads057z8jx-system-path.drv
  /nix/store/ly9r5vhly6xiww36yy16gxrkkgvkq658-dbus-1.drv

Maybe the order of the arguments matter, I’m not sure about that.