This repository has been archived by the owner on Dec 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
69 lines (61 loc) · 1.84 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
# SPDX-FileCopyrightText: 2023 Dom Rodriguez
#
# SPDX-License-Identifier: MIT
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
nixpkgs-mozilla = {
url = "github:mozilla/nixpkgs-mozilla";
flake = false;
};
};
outputs = { self, flake-utils, naersk, nixpkgs, nixpkgs-mozilla }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = (import nixpkgs) {
inherit system;
overlays = [
(import nixpkgs-mozilla)
];
};
toolchain = (pkgs.rustChannelOf {
date = "2023-08-03";
channel = "stable";
sha256 = "sha256-R0F0Risbr74xg9mEYydyebx/z0Wu6HI0/KWwrV30vZo=";
}).rust.override {
targets = [
"x86_64-unknown-linux-musl"
"armv7-unknown-linux-musleabi"
"armv7-unknown-linux-musleabihf"
"aarch64-unknown-linux-musl"
];
extensions = [
"rust-src"
"rustfmt-preview"
"llvm-tools-preview"
];
};
naersk' = pkgs.callPackage naersk {
cargo = toolchain;
rustc = toolchain;
};
in
rec {
# For `nix build` & `nix run`:
defaultPackage = naersk'.buildPackage {
src = ./.;
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ systemd.dev protobuf ];
cargoBuildOptions = (opts: opts ++ [ "--all-features" "--all-targets" ]);
release = true;
singleStep = true;
};
# For `nix develop` (optional, can be skipped):
devShell = pkgs.mkShell {
nativeBuildInputs = [ toolchain ] ++ (with pkgs; [ pkg-config ]);
buildInputs = with pkgs; [ systemd.dev protobuf ];
};
}
);
}