66 lines
1.8 KiB
Nix
66 lines
1.8 KiB
Nix
{
|
|
description = "Noisebell - GPIO door monitor service";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
crane.url = "github:ipetkov/crane";
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, crane, rust-overlay }:
|
|
let
|
|
forSystem = system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [ rust-overlay.overlays.default ];
|
|
};
|
|
|
|
crossPkgs = import nixpkgs {
|
|
inherit system;
|
|
crossSystem.config = "aarch64-unknown-linux-gnu";
|
|
overlays = [ rust-overlay.overlays.default ];
|
|
};
|
|
|
|
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
|
targets = [ "aarch64-unknown-linux-gnu" ];
|
|
};
|
|
|
|
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
|
|
|
|
src = craneLib.cleanCargoSource ./.;
|
|
|
|
commonArgs = {
|
|
inherit src;
|
|
strictDeps = true;
|
|
doCheck = false;
|
|
|
|
CARGO_BUILD_TARGET = "aarch64-unknown-linux-gnu";
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER =
|
|
"${crossPkgs.stdenv.cc.targetPrefix}cc";
|
|
|
|
HOST_CC = "${pkgs.stdenv.cc.nativePrefix}cc";
|
|
|
|
depsBuildBuild = [ crossPkgs.stdenv.cc ];
|
|
};
|
|
|
|
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
|
|
|
noisebell = craneLib.buildPackage (commonArgs // {
|
|
inherit cargoArtifacts;
|
|
});
|
|
in
|
|
{
|
|
packages.aarch64-linux.default = noisebell;
|
|
packages.aarch64-linux.noisebell = noisebell;
|
|
|
|
devShells.${system}.default = craneLib.devShell {
|
|
packages = [ pkgs.rust-analyzer ];
|
|
};
|
|
};
|
|
in
|
|
forSystem "x86_64-linux";
|
|
}
|