-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathflake.nix
More file actions
95 lines (86 loc) · 2.34 KB
/
Copy pathflake.nix
File metadata and controls
95 lines (86 loc) · 2.34 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
88
89
90
91
92
93
94
95
{
description = "cli development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = {
self,
nixpkgs,
rust-overlay,
}: let
overlays = [
(import rust-overlay)
(self: super: {
rustToolchain =
(super.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml).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
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
rustPlatform = pkgs.makeRustPlatform {
cargo = pkgs.rustToolchain;
rustc = pkgs.rustToolchain;
};
in {
zoo = rustPlatform.buildRustPackage {
pname = "zoo";
version = cargoToml.package.version;
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"openapitor-0.0.9" = "sha256-XPwEzO/aJaWDag2deZHOlG/gfbPlrKtcVXGAucyGx2s=";
};
};
doCheck = false;
nativeBuildInputs = [pkgs.pkg-config];
buildInputs = [pkgs.openssl];
};
default = self.packages.${system}.zoo;
});
};
}