-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
69 lines (66 loc) · 1.93 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
{
description = "coinmarket tui";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = {
self,
nixpkgs,
rust-overlay,
flake-utils,
...
}:
{
overlay = final: prev:
let
buildInputs = [] ++ final.lib.optionals final.stdenv.isDarwin (with final.darwin.apple_sdk.frameworks; [
SystemConfiguration
]);
RUSTFLAGS = "-C link-arg=-s";
in
{
coinmarket = final.rustPlatform.buildRustPackage ({
inherit buildInputs RUSTFLAGS;
pname = "coinmarket";
version = "0.1.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
}) // { meta.description = "CoinMarket TUI based on Ratatui"; };
};
} //
flake-utils.lib.eachDefaultSystem (system:
let
makePkgs = config:
let
shouldUseCross = builtins.elem config [
"aarch64-unknown-linux-musl"
"x86_64-unknown-linux-musl"
];
crossSystemOptions = if shouldUseCross then {
crossSystem = {
inherit config;
rustc = {inherit config;};
isStatic = true;
};
} else {};
pkgs = import nixpkgs (crossSystemOptions // {
inherit system;
overlays = [ rust-overlay.overlays.default self.overlay ];
});
in
pkgs.coinmarket;
in {
packages = {
default = makePkgs "${system}";
x86_64-linux-musl = makePkgs "x86_64-unknown-linux-musl";
aarch64-linux-musl = makePkgs "aarch64-unknown-linux-musl";
};
}
);
}