summaryrefslogtreecommitdiff
path: root/archived/projt-launcher/ci/eval/chunk.nix
diff options
context:
space:
mode:
Diffstat (limited to 'archived/projt-launcher/ci/eval/chunk.nix')
-rw-r--r--archived/projt-launcher/ci/eval/chunk.nix69
1 files changed, 69 insertions, 0 deletions
diff --git a/archived/projt-launcher/ci/eval/chunk.nix b/archived/projt-launcher/ci/eval/chunk.nix
new file mode 100644
index 0000000000..12b02a7f28
--- /dev/null
+++ b/archived/projt-launcher/ci/eval/chunk.nix
@@ -0,0 +1,69 @@
+# =============================================================================
+# ProjT Launcher - Build Configuration Chunking
+# =============================================================================
+# Splits build configurations into smaller chunks for parallel validation.
+# This allows CI to validate multiple configurations in parallel.
+#
+# Usage:
+# nix-instantiate --eval ci/eval/chunk.nix \
+# --arg chunkSize 10 \
+# --arg myChunk 0 \
+# --arg attrpathFile ./attrpaths.json
+# =============================================================================
+
+{
+ lib ? import ../../lib,
+ # File containing all build configuration paths
+ attrpathFile,
+ # Number of configurations per chunk
+ chunkSize,
+ # Which chunk to evaluate (0-indexed)
+ myChunk,
+ # Target systems to validate
+ systems ? [ "x86_64-linux" ],
+}:
+
+let
+ # Import all attribute paths
+ allPaths = lib.importJSON attrpathFile;
+
+ # Get this chunk's paths
+ chunkPaths = lib.sublist (chunkSize * myChunk) chunkSize allPaths;
+
+ # Build configuration validation
+ validateConfig =
+ configPath:
+ let
+ configType = builtins.head configPath;
+ configValue = builtins.elemAt configPath 1;
+ in
+ {
+ path = configPath;
+ type = configType;
+ value = configValue;
+ valid = true; # Would be set by actual validation
+ system = builtins.head systems;
+ };
+
+ # Validate all paths in this chunk
+ validatedConfigs = map validateConfig chunkPaths;
+
+ # Group by type for easier processing
+ groupedConfigs = lib.groupBy (c: c.type) validatedConfigs;
+
+in
+{
+ # Return validated configurations
+ configs = validatedConfigs;
+
+ # Chunk metadata
+ meta = {
+ chunkIndex = myChunk;
+ inherit chunkSize;
+ totalInChunk = builtins.length chunkPaths;
+ inherit systems;
+ };
+
+ # Grouped view
+ byType = groupedConfigs;
+}