-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
82 lines (76 loc) · 2.5 KB
/
flake.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{
outputs =
{ self }:
let
nameValuePair = name: value: { inherit name value; };
genAttrs = names: f: builtins.listToAttrs (map (n: nameValuePair n (f n)) names);
srcs = import ./sources.nix;
forEachSystem = genAttrs [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
];
# We only run tests for x86_64-linux in CI
forEachTestSystem = genAttrs [
"x86_64-linux"
];
in
{
packages = forEachSystem (
system:
let
pkgs = import srcs.nixpkgs {
inherit system;
overlays = [
(import srcs.rust-overlay)
(final: prev: {
rust =
let
rustStable = final.rust-bin.stable.${srcs.rust-version}.default;
in
prev.rust
// {
packages = prev.rust.packages // {
stable = {
rustPlatform = final.makeRustPlatform {
inherit (final.rust.packages.stable) rustc cargo;
};
inherit (final.rust.packages.stable.rustPlatform) rust;
rustc = rustStable;
cargo = rustStable;
};
};
};
})
];
};
inherit (pkgs) lib;
in
{
holo-dev-server-bin =
let
src = srcs.${system}.holo-dev-server-bin;
in
pkgs.runCommand "holo-dev-server-bin"
{
# holo-dev-server.deps.json contains the build-time dependencies of
# the original holo-dev-server binary.
# Nix detects runtime dependencies by scanning for the out path
# hashes of the build-time inputs.
# NOTE: these dependencies are not vendored! So users need to be
# able to either build or substitute them.
buildInputs = map (inputAttr: pkgs.${inputAttr}) (
(lib.importJSON ./holo-dev-server.deps.json).dependencies
);
}
''
mkdir -p $out/bin
cp -a ${src}/bin/holo-dev-server $out/bin/holo-dev-server
'';
}
);
checks = forEachTestSystem (system: {
holo-dev-server-bin = self.packages.${system}.holo-dev-server-bin;
});
};
}