-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathflake.nix
71 lines (61 loc) · 1.96 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, utils, naersk, rust-overlay }:
utils.lib.eachDefaultSystem (
system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
naersk' = pkgs.callPackage naersk {
cargo = toolchain;
rustc = toolchain;
clippy = toolchain;
};
buildInputs = with pkgs; [
pkg-config
libusb1
binutils
] ++
(lib.optionals (stdenv.hostPlatform.isLinux) [
udev
]) ++
(lib.optionals (stdenv.hostPlatform.isDarwin) [
darwin.apple_sdk.frameworks.IOKit
darwin.apple_sdk.frameworks.AppKit
iconv
]);
in
{
formatter = pkgs.nixpkgs-fmt;
packages = {
# For `nix build` `nix run`, & `nix profile install`:
default = naersk'.buildPackage {
pname = "sinowealth-kb-tool";
version = "latest";
src = ./.;
doCheck = true; # run `cargo test` on build
inherit buildInputs;
meta = with pkgs.lib; {
description = "A utility for reading and writing flash contents on Sinowealth 8051-based devices";
homepage = "https://github.com/carlossless/sinowealth-kb-tool";
license = licenses.mit;
mainProgram = "sinowealth-kb-tool";
maintainers = with maintainers; [ carlossless ];
};
};
};
devShells.default = pkgs.mkShell {
inherit buildInputs;
nativeBuildInputs = with pkgs; [ rustup toolchain ];
};
}
);
}