zhaofengli / colmena

A simple, stateless NixOS deployment tool

Home Page:https://colmena.cli.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Force local / remote build for specific derivations

oddlama opened this issue · comments

Generally I prefer building on target hosts, but I have several huge derivations that take a long time to build. I'd like to tell colmena that I want to build everything on the remote machines by default (deployment.buildOnTarget = true), excluding some specific derivations which instead must be built locally and copied to the target. Is that possible somehow?

EDIT: I think the opposite can be achieved by specifying drv.allowSubstitutes = false; causing the package to always be built on the remote machine. Does colmena honor this settings? Regarding my initial question, there also is drv.preferLocalBuild which almost seems to be what I need with the downside that local builds are just preferred but not enforced.

This is a bit tricky because the way buildOnTarget works is that the builds are initiated on the target nodes themselves, so from the nodes' perspective they are building everything locally. For the bigger derivations you could build them separately before invoking Colmena. When copying the derivations to the remote nodes, Colmena will copy outputs that already exist.

Colmena will copy outputs that already exist

Awesome, if this is guaranteed then this is a good workaround for me personally. Not sure if a separate mechanism might be interesting for the future though. Might be a niche use case.