init
This commit is contained in:
69
flake.nix
Normal file
69
flake.nix
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
description = "Rust library for interacting with wiringOP (Orange Pi fork of wiringPi)";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.05";
|
||||
|
||||
fenix.url = "github:nix-community/fenix";
|
||||
|
||||
naersk.url = "github:nix-community/naersk";
|
||||
|
||||
wiringop = {
|
||||
url = "github:orangepi-xunlong/wiringOP";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, fenix, naersk, wiringop, flake-utils }: flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
target = "aarch64-unknown-linux-gnu";
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
fenix.overlays.default
|
||||
];
|
||||
};
|
||||
|
||||
devToolchain = with fenix.packages.${system}; combine [
|
||||
stable.cargo
|
||||
stable.rustc
|
||||
stable.clippy
|
||||
stable.rustfmt
|
||||
targets.${target}.stable.rust-std
|
||||
];
|
||||
|
||||
CARGO_BUILD_TARGET = target;
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER =
|
||||
let
|
||||
inherit (pkgs.pkgsCross.aarch64-multiplatform.stdenv) cc;
|
||||
in
|
||||
"${cc}/bin/${cc.targetPrefix}cc";
|
||||
|
||||
wiringop-headers = pkgs.runCommandLocal "wiringOP-headers" { } ''
|
||||
mkdir -p $out/include
|
||||
cp ${wiringop}/wiringPi/*.h $out/include
|
||||
'';
|
||||
|
||||
LIBCLANG_PATH = "${pkgs.llvmPackages_18.clang-unwrapped.lib}/lib";
|
||||
in
|
||||
{
|
||||
devShells.default =
|
||||
pkgs.mkShell {
|
||||
nativeBuildInputs = [
|
||||
devToolchain
|
||||
pkgs.llvmPackages_18.clang
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
wiringop-headers
|
||||
pkgs.libxcrypt
|
||||
];
|
||||
|
||||
WIRINGOP_PATH = "${wiringop}";
|
||||
|
||||
inherit LIBCLANG_PATH CARGO_BUILD_TARGET CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER;
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user