This repository has been archived by the owner on Jul 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
flake.nix
76 lines (64 loc) · 2.05 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
{
inputs = {
nixpkgs.url = "flake:nixpkgs/nixpkgs-unstable";
utils.url = "flake:flake-utils";
};
outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem
(system:
let
# enable musl on Linux will trigger a toolchain rebuild
# making the build very slow
pkgs = import nixpkgs { inherit system; };
# if nixpkgs.legacyPackages.${system}.stdenv.hostPlatform.isLinux
# then nixpkgs.legacyPackages.${system}.pkgsMusl
# else nixpkgs.legacyPackages.${system};
crunchy-cli = pkgs.rustPlatform.buildRustPackage.override { stdenv = pkgs.clangStdenv; } rec {
pname = "crunchy-cli";
inherit ((pkgs.lib.importTOML ./Cargo.toml).package) version;
src = pkgs.lib.cleanSource ./.;
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
buildNoDefaultFeatures = true;
buildFeatures = [ "openssl-tls" ];
nativeBuildInputs = [
pkgs.pkg-config
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.xcbuild
];
buildInputs = [
pkgs.openssl
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.Security
];
};
in
{
packages.default = crunchy-cli;
devShells.default = pkgs.mkShell {
packages = with pkgs; [
cargo
clippy
rust-analyzer
rustc
rustfmt
];
inputsFrom = builtins.attrValues self.packages.${system};
buildInputs = [
pkgs.openssl
pkgs.libiconv
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.CoreServices
pkgs.darwin.Security
];
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
};
formatter = pkgs.nixpkgs-fmt;
}
) // {
overlays.default = final: prev: {
inherit (self.packages.${final.system}) crunchy-cli;
};
};
}