blob: 9eb410595974d304f28cc1f470733d27f5962c52 (
plain) (
blame)
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
|
args@{ callPackage
, lib
, ...
}:
# Type aliases
# Release = {
# version: String
# hash: String
# supportedGpuTargets: List String
# }
let
inherit (lib) lists strings trivial;
computeName = version: "magma_${strings.replaceStrings [ "." ] [ "_" ] version}";
# buildMagmaPackage :: Release -> Derivation
buildMagmaPackage = magmaRelease: callPackage ./generic.nix (
(builtins.removeAttrs args [ "callPackage" ]) // {
inherit magmaRelease;
}
);
# Reverse the list to have the latest release first
# magmaReleases :: List Release
magmaReleases = lists.reverseList (builtins.import ./releases.nix);
# The latest release is the first element of the list and will be our default choice
# latestReleaseName :: String
latestReleaseName = computeName (builtins.head magmaReleases).version;
# Function to transform our releases into build attributes
# toBuildAttrs :: Release -> { name: String, value: Derivation }
toBuildAttrs = release: {
name = computeName release.version;
value = buildMagmaPackage release;
};
# Add all supported builds as attributes
# allBuilds :: AttrSet String Derivation
allBuilds = builtins.listToAttrs (lists.map toBuildAttrs magmaReleases);
# The latest release will be our default build
# defaultBuild :: AttrSet String Derivation
defaultBuild.magma = allBuilds.${latestReleaseName};
# builds :: AttrSet String Derivation
builds = allBuilds // defaultBuild;
in
builds
|