-
Notifications
You must be signed in to change notification settings - Fork 1
/
ci.nix
53 lines (53 loc) · 1.87 KB
/
ci.nix
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
{ pkgs, channels, lib, config, ... }: with pkgs; with lib; let
inherit (import ./. { inherit pkgs; }) checks inputs;
in {
config = {
name = "cstrptr";
ci.gh-actions.enable = true;
cache.cachix = {
ci.signingKey = "";
arc.enable = true;
};
channels = {
nixpkgs = "22.11";
};
tasks = {
rustfmt.inputs = singleton checks.rustfmt;
version.inputs = singleton checks.version;
build.inputs = singleton (checks.test.override {
inherit (config.cstrptr) rustPlatform features;
});
};
jobs = let
rustPlatforms = {
stable = pkgs.rustPlatform;
nightly = inputs.rust.legacyPackages.${system}.unstable.rustPlatform;
};
channels = [ "stable" "nightly" ];
features = [ "std" "alloc" "unstable" "memchr" ];
validate = channel: features:
(channel == "nightly" || all (f: f != "unstable") features) && # unstable feature can only be used on nightly
count (f: f == "std" || f == "alloc") features < 2; # combining std with alloc is meaningless
features' = genList (_: features ++ [ null ]) (length features + 1);
filtered = list: unique (filter (f: f != null) list);
permuted = unique (crossLists (a: b: c: d: e: filtered [ a b c d e ]) features');
in listToAttrs (filter (v: v != null) (flip crossLists [ channels permuted ] (channel: features: if validate channel features
then nameValuePair "${channel}${optionalString (features != []) "-${concatStringsSep "-" features}"}" ({ ... }: {
cstrptr = {
rustPlatform = rustPlatforms.${channel};
inherit features;
};
}) else null
)));
};
options.cstrptr = with types; {
rustPlatform = mkOption {
type = unspecified;
default = pkgs.rustPlatform;
};
features = mkOption {
type = listOf str;
default = [ "default" ];
};
};
}