-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathflake.nix
More file actions
87 lines (79 loc) · 2.04 KB
/
flake.nix
File metadata and controls
87 lines (79 loc) · 2.04 KB
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
{
description = "cli development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
naersk.url = "github:nix-community/naersk";
};
outputs = {
self,
nixpkgs,
rust-overlay,
naersk,
}: let
overlays = [
(import rust-overlay)
(self: super: {
rustToolchain = super.rust-bin.stable.latest.default.override {
targets = ["wasm32-unknown-unknown"];
extensions = ["rustfmt" "llvm-tools-preview" "rust-src"];
};
# stand-alone nightly formatter so we get the fancy unstable flags
nightlyRustfmt = super.rust-bin.selectLatestNightlyWith (toolchain:
toolchain.default.override {
extensions = ["rustfmt"]; # just the formatter
});
})
];
allSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f:
nixpkgs.lib.genAttrs allSystems (system:
f {
pkgs = import nixpkgs {
inherit overlays system;
};
system = system;
});
in {
devShells = forAllSystems ({pkgs, ...}: {
default = pkgs.mkShell {
packages =
(with pkgs; [
rustToolchain
nightlyRustfmt
cargo-sort
toml-cli
openssl
postgresql
pkg-config
])
++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [
]);
RUSTFMT = "${pkgs.nightlyRustfmt}/bin/rustfmt";
};
});
packages = forAllSystems ({
pkgs,
system,
}: let
naersk-lib = pkgs.callPackage naersk {
cargo = pkgs.rustToolchain;
rustc = pkgs.rustToolchain;
};
in {
zoo = naersk-lib.buildPackage {
pname = "zoo";
version = "0.1.0";
release = true;
src = ./.;
buildInputs = [pkgs.openssl pkgs.pkg-config];
};
default = self.packages.${system}.zoo;
});
};
}