From d41120e2639e5c52461f3fb95da35e6e8df96df1 Mon Sep 17 00:00:00 2001 From: Willem Vanhulle Date: Thu, 5 Nov 2026 20:42:31 +0100 Subject: [PATCH] ci: sync the shared CI tasks Make cargoToolchain optional in nix/ci-tasks.nix, so repositories without Rust use the same file, and add a copy-build-output task that copies a build result into the checkout as writable files. The shared files in ci/ and nix/ci-tasks.nix stay identical across repositories. Claude-Session: https://claude.ai/code/session_01D8dLLgYd8cfR2aQfA5eZXa --- ci/nix-built-paths.nu | 14 ++++++++++++++ nix/ci-tasks.nix | 25 +++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/ci/nix-built-paths.nu b/ci/nix-built-paths.nu index 9b3444c..824ee11 100755 --- a/ci/nix-built-paths.nu +++ b/ci/nix-built-paths.nu @@ -74,6 +74,20 @@ def "main upload-exported-paths" []: nothing -> nothing { } } +def "main copy-build-output" [ + build_output: path + destination: path +]: nothing -> nothing { + if ($build_output | path expand | path type) == dir { + mkdir $destination + for output_entry in (ls $build_output | get name) { + cp --recursive --preserve [] $output_entry $destination + } + } else { + cp --preserve [] $build_output $destination + } +} + def main []: nothing -> nothing { print "Run a subcommand, for example: build-and-export-paths" } diff --git a/nix/ci-tasks.nix b/nix/ci-tasks.nix index 931b074..26fc399 100644 --- a/nix/ci-tasks.nix +++ b/nix/ci-tasks.nix @@ -1,14 +1,16 @@ { pkgs, mkApp, - cargoToolchain, - preCommitInputs, + cargoToolchain ? null, + preCommitInputs ? [ ], extraReleaseInputs ? [ ], releaseWrapperArgs ? [ ], }: let inherit (pkgs) lib; + cargoInputs = lib.optional (cargoToolchain != null) cargoToolchain; + nuScriptTool = { script, @@ -49,12 +51,13 @@ let mkApp (nuScriptTool { inherit name; script = ../ci/release-tasks.nu; - runtimeInputs = [ - cargoToolchain - pkgs.release-plz - pkgs.gitMinimal - ] - ++ extraReleaseInputs; + runtimeInputs = + cargoInputs + ++ [ + pkgs.release-plz + pkgs.gitMinimal + ] + ++ extraReleaseInputs; wrapperArgs = releaseWrapperArgs; }); @@ -96,8 +99,7 @@ releaseTaskApps open-dependency-update-pr = mkApp (nuScriptTool { name = "open-dependency-update-pr"; script = ../ci/dependency-updates.nu; - runtimeInputs = [ - cargoToolchain + runtimeInputs = cargoInputs ++ [ pkgs.gitMinimal pkgs.tea ]; @@ -108,6 +110,9 @@ releaseTaskApps import-exported-paths = mkApp (nixBuiltPathsTool { name = "import-exported-paths"; }); + copy-build-output = mkApp (nixBuiltPathsTool { + name = "copy-build-output"; + }); upload-exported-paths = mkApp (nixBuiltPathsTool { name = "upload-exported-paths"; runtimeInputs = [ pkgs.cachix ];