This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflake.nix
68 lines (57 loc) · 1.72 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
{
description = "Themelio wallet daemon";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
inputs.naersk = {
url = "github:nmattia/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{ self
, nixpkgs
, flake-utils
, fenix
, naersk
, ...
} @inputs:
flake-utils.lib.eachDefaultSystem
(system: let
target = "x86_64-unknown-linux-musl";
#target = "x86_64-unknown-linux-gnu";
pkgs = import nixpkgs {
inherit system;
};
# Rust toolchain
toolchain = with fenix.packages.${system};
combine [
stable.rustc
stable.cargo
#targets.${target}.stable.rust-std
];
# To read melwalletd project metadata
cargoToml = (builtins.fromTOML (builtins.readFile ./Cargo.toml));
in rec {
# Build melwalletd with musl
packages.melwalletd = (naersk.lib.${system}.override {
cargo = toolchain;
rustc = toolchain;
}).buildPackage {
pname = "melwalletd";
root = ./.;
#CARGO_BUILD_TARGET = target;
#CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER =
#"${pkgs.pkgsCross.aarch64-multiplatform.stdenv.cc}/bin/${target}-gcc";
};
defaultPackage = packages.melwalletd;
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ toolchain ];
shellHook = ''
export PATH=$PATH:${packages.melwalletd}/bin
'';
};
});
}