blob: 12b02a7f280084ddc2972bf75126c6f6594d55e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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;
}
|