87 lines
2.2 KiB
Nix
87 lines
2.2 KiB
Nix
{
|
|
description = "Flake for the servicepoint library.";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
}:
|
|
let
|
|
lib = nixpkgs.lib;
|
|
supported-systems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"aarch64-darwin"
|
|
"x86_64-darwin"
|
|
];
|
|
forAllSystems =
|
|
f:
|
|
lib.genAttrs supported-systems (
|
|
system:
|
|
f rec {
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
selfPkgs = self.packages.${system};
|
|
inherit system;
|
|
}
|
|
);
|
|
in
|
|
{
|
|
packages = forAllSystems (
|
|
{ pkgs, selfPkgs, ... }:
|
|
{
|
|
servicepoint-binding-uniffi = pkgs.rustPlatform.buildRustPackage {
|
|
pname = "servicepoint-binding-uniffi";
|
|
version = "0.13.1";
|
|
|
|
src = ./.;
|
|
cargoDeps = pkgs.rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = with pkgs; [
|
|
xe
|
|
xz
|
|
];
|
|
|
|
postInstall = ''
|
|
mkdir -p $out/lib/pkgconfig
|
|
sed "s:\$out:$out:g" ${./servicepoint-binding-uniffi.pc.in} | sed "s:\$version:$version:g" > $out/lib/pkgconfig/servicepoint-binding-uniffi.pc
|
|
'';
|
|
};
|
|
default = selfPkgs.servicepoint-binding-uniffi;
|
|
}
|
|
);
|
|
|
|
devShells = forAllSystems (
|
|
{ pkgs, selfPkgs, ... }:
|
|
{
|
|
default = pkgs.mkShell {
|
|
inputsFrom = [ selfPkgs.default ];
|
|
packages = with pkgs; [
|
|
(pkgs.symlinkJoin {
|
|
name = "rust-toolchain";
|
|
paths = with pkgs; [
|
|
rustc
|
|
cargo
|
|
rustPlatform.rustcSrc
|
|
rustfmt
|
|
clippy
|
|
cargo-expand
|
|
cargo-tarpaulin
|
|
];
|
|
})
|
|
];
|
|
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
|
};
|
|
}
|
|
);
|
|
|
|
formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-tree);
|
|
};
|
|
}
|