aboutsummaryrefslogtreecommitdiff
path: root/default.nix
blob: efbc4c86d3d80eed7e6c9a6af2c6c6d93c163f1b (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
54
55
56
57
58
59
60
61
62
63
{
  system ? builtins.currentSystem,
  git_version ? null,
}:

with import ./nix/common.nix;

let
  pkgs = import pkgsSrc { };
  compile = import ./nix/compile.nix;

  build_debug_and_release = (target: {
    debug = (compile {
      inherit target git_version;
      release = false;
    }).workspace.garage {
      compileMode = "build";
    };

    release = (compile {
      inherit target git_version;
      release = true;
    }).workspace.garage {
      compileMode = "build";
    };
  });

  test = (rustPkgs: pkgs.symlinkJoin {
    name ="garage-tests";
    paths = builtins.map (key: rustPkgs.workspace.${key} { compileMode = "test"; }) (builtins.attrNames rustPkgs.workspace);
  });

in {
  pkgs = {
    amd64 = build_debug_and_release "x86_64-unknown-linux-musl";
    i386 = build_debug_and_release "i686-unknown-linux-musl";
    arm64 = build_debug_and_release "aarch64-unknown-linux-musl";
    arm = build_debug_and_release "armv6l-unknown-linux-musleabihf";
  };
  test = {
    amd64 = test (compile {
      inherit git_version;
      target = "x86_64-unknown-linux-musl";
      features = [
        "garage/bundled-libs"
        "garage/k2v"
        "garage/sled"
        "garage/lmdb"
        "garage/sqlite"
        "garage_db/sled"
        "garage_db/lmdb"
        "garage_db/sqlite"
      ];
    });
  };
  clippy = {
    amd64 = (compile {
      inherit git_version;
      target = "x86_64-unknown-linux-musl";
      compiler = "clippy";
    }).workspace.garage {} ;
  };
}