diff --git a/buildbot_nix/__init__.py b/buildbot_nix/__init__.py index 1cb5744..4ff42f6 100644 --- a/buildbot_nix/__init__.py +++ b/buildbot_nix/__init__.py @@ -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", 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(