servicepoint-cli/flake.nix

116 lines
2.7 KiB
Nix
Raw Normal View History

2025-02-08 12:36:09 +01:00
{
2025-02-12 20:30:27 +01:00
description = "Flake for command line interface of the ServicePoint display.";
2025-02-08 12:36:09 +01:00
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nix-filter.url = "github:numtide/nix-filter";
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{
self,
nixpkgs,
naersk,
nix-filter,
}:
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};
inherit system;
}
);
in
rec {
packages = forAllSystems (
{ pkgs, ... }:
let
naersk' = pkgs.callPackage naersk { };
in
rec {
servicepoint-cli = naersk'.buildPackage rec {
src = nix-filter.lib.filter {
root = ./.;
include = [
./Cargo.toml
./Cargo.lock
./src
./README.md
./LICENSE
];
};
nativeBuildInputs = with pkgs; [
pkg-config
2025-02-12 20:30:27 +01:00
libclang
rustPlatform.bindgenHook
2025-02-08 12:36:09 +01:00
];
strictDeps = true;
2025-02-12 20:30:27 +01:00
buildInputs =
with pkgs;
[
xe
xz
clang
]
++ lib.optionals pkgs.stdenv.isLinux (
with pkgs;
[
dbus
pipewire
libclang
]
);
2025-02-08 12:36:09 +01:00
};
default = servicepoint-cli;
}
);
legacyPackages = packages;
devShells = forAllSystems (
{
pkgs,
system,
}:
{
default = pkgs.mkShell rec {
inputsFrom = [ self.packages.${system}.default ];
packages = [
pkgs.gdb
(pkgs.symlinkJoin {
name = "rust-toolchain";
paths = with pkgs; [
rustc
cargo
rustPlatform.rustcSrc
rustfmt
clippy
cargo-expand
];
})
];
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath (builtins.concatMap (d: d.buildInputs) inputsFrom)}";
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
}
);
formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-rfc-style);
};
}