feat: enable per-worker local store slots #24

Open
raito wants to merge 20 commits from local-stores into main
Showing only changes of commit 8048398941 - Show all commits

View file

@ -58,14 +58,17 @@ class NixBuilder:
publicHostKey: str | None = None
sshUser: str | None = None
sshKey: str | None = None
systems: list[str] = field(default_factory=lambda: ["-"])
supportedFeatures: list[str] = field(default_factory=lambda: ["-"])
mandatoryFeatures: list[str] = field(default_factory=lambda: ["-"])
systems: list[str] = field(default_factory=lambda: [])
supportedFeatures: list[str] = field(default_factory=lambda: [])
mandatoryFeatures: list[str] = field(default_factory=lambda: [])
def to_nix_line(self):
systems = ["-"] if not self.systems else self.systems
supportedFeatures = ["-"] if not self.supportedFeatures else self.supportedFeatures
mandatoryFeatures = ["-"] if not self.mandatoryFeatures else self.mandatoryFeatures
encoded_public_key = base64.b64encode(self.publicHostKey.encode('ascii')).decode('ascii') if self.publicHostKey is not None else "-"
fullConnection = f"{self.protocol}://{self.sshUser}@{self.hostName}" if self.sshUser is not None else self.hostName
return f"{fullConnection} {",".join(self.systems)} {self.sshKey or "-"} {self.maxJobs} {self.speedFactor} {",".join(self.supportedFeatures)} {",".join(self.mandatoryFeatures)} {encoded_public_key}"
return f"{fullConnection} {",".join(systems)} {self.sshKey or "-"} {self.maxJobs} {self.speedFactor} {",".join(supportedFeatures)} {",".join(mandatoryFeatures)} {encoded_public_key}"
@dataclass
@ -658,6 +661,20 @@ def nix_build_config(
) -> util.BuilderConfig:
"""Builds one nix flake attribute."""
factory = util.BuildFactory()
factory.addStep(
steps.ShellCommand(
name="Copy the derivation to the local worker store",
command=[
"nix",
"copy",
"--derivation",
"--to",
"../store",
util.Interpolate("%(prop:drv_path)s^*")
]
)
)
factory.addStep(
NixBuildCommand(
env={},
@ -679,6 +696,8 @@ def nix_build_config(
"7200",
"--builders",
builders_spec,
"--store",
util.Interpolate("%(prop:builddir)s/store"),
"--out-link",
Review

does this require trusted user on localhost? or wait, are we doing this to prevent needing trusted user while still doing remote builds? am confuse

does this require trusted user on localhost? or wait, are we doing this to prevent needing trusted user while still doing remote builds? am confuse
Review

no, it doesn't anymore!

no, it doesn't anymore!
Review

(and yes, that's correct, that's untrusted remote building!)

(and yes, that's correct, that's untrusted remote building!)
util.Interpolate("result-%(prop:attr)s"),
util.Interpolate("%(prop:drv_path)s^*"),
@ -698,6 +717,8 @@ def nix_build_config(
"nix",
"store",
"sign",
"--store",
util.Interpolate("%(prop:builddir)s/store"),
"--key-file",
signing_keyfile,
util.Interpolate(