-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
77 lines (70 loc) · 2.19 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
{
description = "ipso";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
cargo2nix.url = "github:cargo2nix/cargo2nix";
};
outputs = { self, nixpkgs, flake-utils, cargo2nix, rust-overlay }:
let
systemTargets = {
"x86_64-linux" = "x86_64-unknown-linux-musl";
"x86_64-darwin" = "x86_64-apple-darwin";
};
in
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
cargo2nix.overlays.default
rust-overlay.overlays.default
];
};
rustVersion = "1.69.0";
rustPkgs = { release }: pkgs.rustBuilder.makePackageSet {
rustChannel = rustVersion;
packageFun = import "${self}/Cargo.nix";
inherit release;
target = systemTargets.${system};
};
in rec {
packages = {
ipso-cli = (rustPkgs { release = true; }).workspace.ipso-cli {};
ipso-golden = pkgs.haskell.lib.justStaticExecutables (import ./tests/golden { inherit pkgs; });
ipso-shebang = pkgs.haskell.lib.justStaticExecutables (import ./tests/shebang { inherit pkgs; });
};
defaultPackage = packages.ipso-cli;
devShell =
pkgs.mkShell {
buildInputs = [
cargo2nix.packages.${system}.cargo2nix
(pkgs.rust-bin.stable.${rustVersion}.default.override {
extensions = [
"cargo"
"clippy"
"rustc"
"rust-src"
"rustfmt"
"rust-analyzer"
];
})
# for running tests locally
pkgs.cabal2nix
packages.ipso-golden
packages.ipso-shebang
# profiling
pkgs.kcachegrind
pkgs.valgrind
];
};
devShells.tests =
(rustPkgs { release = false; }).workspaceShell {
buildInputs = [
packages.ipso-golden
packages.ipso-shebang
];
};
}
);
}