-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathflake.nix
157 lines (154 loc) · 4.9 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
{
description = "Jrsonnet";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
shelly = {
url = "github:CertainLach/shelly";
inputs = {
flake-parts.follows = "flake-parts";
nixpkgs.follows = "nixpkgs";
};
};
};
outputs = inputs @ {
nixpkgs,
flake-parts,
rust-overlay,
crane,
shelly,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [shelly.flakeModule];
systems = ["x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux" "mingw-w64"];
perSystem = {
config,
system,
...
}: let
pkgs = import nixpkgs {
inherit system;
overlays = [rust-overlay.overlays.default];
config.allowUnsupportedSystem = true;
};
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLib = (crane.mkLib pkgs).overrideToolchain rust;
in {
legacyPackages = {
jsonnetImpls = {
go-jsonnet = pkgs.callPackage ./nix/go-jsonnet.nix {};
sjsonnet = pkgs.callPackage ./nix/sjsonnet.nix {};
jsonnet = pkgs.callPackage ./nix/jsonnet.nix {};
# I didn't managed to build it, and nixpkgs version is marked as broken
# haskell-jsonnet = pkgs.callPackage ./nix/haskell-jsonnet.nix { };
rsjsonnet = pkgs.callPackage ./nix/rsjsonnet.nix {};
};
};
packages = rec {
default = jrsonnet;
jrsonnet = pkgs.callPackage ./nix/jrsonnet.nix {
inherit craneLib;
};
jrsonnet-nightly = pkgs.callPackage ./nix/jrsonnet.nix {
inherit craneLib;
withNightlyFeatures = true;
};
jrsonnet-experimental = pkgs.callPackage ./nix/jrsonnet.nix {
inherit craneLib;
withExperimentalFeatures = true;
};
jrsonnet-release = pkgs.callPackage ./nix/jrsonnet-release.nix {
rustPlatform = pkgs.makeRustPlatform {
rustc = rust;
cargo = rust;
};
};
benchmarks = pkgs.callPackage ./nix/benchmarks.nix {
inherit (config.legacyPackages.jsonnetImpls) go-jsonnet sjsonnet jsonnet rsjsonnet;
jrsonnetVariants = [
{
drv = jrsonnet.override {forBenchmarks = true;};
name = "";
}
];
};
benchmarks-quick = pkgs.callPackage ./nix/benchmarks.nix {
inherit (config.legacyPackages.jsonnetImpls) go-jsonnet sjsonnet jsonnet rsjsonnet;
quick = true;
jrsonnetVariants = [
{
drv = jrsonnet.override {forBenchmarks = true;};
name = "";
}
];
};
benchmarks-against-release = pkgs.callPackage ./nix/benchmarks.nix {
inherit (config.legacyPackages.jsonnetImpls) go-jsonnet sjsonnet jsonnet rsjsonnet;
jrsonnetVariants = [
{
drv = jrsonnet.override {forBenchmarks = true;};
name = "current";
}
{
drv = jrsonnet-nightly.override {forBenchmarks = true;};
name = "current-nightly";
}
{
drv = jrsonnet-release.override {forBenchmarks = true;};
name = "release";
}
];
};
benchmarks-quick-against-release = pkgs.callPackage ./nix/benchmarks.nix {
inherit (config.legacyPackages.jsonnetImpls) go-jsonnet sjsonnet jsonnet rsjsonnet;
quick = true;
jrsonnetVariants = [
{
drv = jrsonnet.override {forBenchmarks = true;};
name = "current";
}
{
drv = jrsonnet-nightly.override {forBenchmarks = true;};
name = "current-nightly";
}
{
drv = jrsonnet-release.override {forBenchmarks = true;};
name = "release";
}
];
};
};
shelly.shells.default = {
factory = craneLib.devShell;
packages = with pkgs;
[
alejandra
cargo-edit
cargo-asm
cargo-outdated
cargo-watch
cargo-insta
lld
hyperfine
graphviz
]
++ lib.optionals (!stdenv.isDarwin) [
valgrind
kcachegrind
];
};
};
};
}