Files
nixpkgs/pkgs/by-name/ch/chameleon-cli/package.nix

86 lines
1.7 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
cmake,
makeWrapper,
openssl,
xz,
python3,
nix-update-script,
}:
let
# https://github.com/RfidResearchGroup/ChameleonUltra/blob/main/software/script/requirements.txt
pythonPath =
with python3.pkgs;
makePythonPath [
colorama
prompt-toolkit
pyserial
];
in
stdenv.mkDerivation (finalAttrs: {
pname = "chameleon-cli";
version = "2.2.0-unstable-2026-08-10";
src = fetchFromGitHub {
owner = "RfidResearchGroup";
repo = "ChameleonUltra";
rev = "0c1d5791b46e8ac1a87cb8e356f180b1394fb827";
rootDir = "software";
hash = "sha256-vbY1kU67fnVUlQYSx3oG/xKPKRWSUBVXfR9hk+MaoyA=";
};
postPatch = ''
substituteInPlace src/CMakeLists.txt \
--replace-fail "liblzma" "lzma" \
--replace-fail "FetchContent_MakeAvailable(xz)" ""
'';
nativeBuildInputs = [
cmake
makeWrapper
];
buildInputs = [
openssl
xz
];
cmakeFlags = [
"-S"
"../src"
];
installPhase = ''
runHook preInstall
mkdir -p $out/libexec
cp -r ../script/* $out/libexec
rm -r $out/libexec/tests
rm $out/libexec/requirements.txt
makeWrapper ${lib.getExe python3} $out/bin/chameleon-cli \
--add-flags "$out/libexec/chameleon_cli_main.py" \
--prefix PYTHONPATH : ${pythonPath}
runHook postInstall
'';
passthru.updateScript = nix-update-script {
extraArgs = [
"--version=branch"
"--version-regex=v(.*)"
];
};
meta = {
description = "Command line interface for Chameleon Ultra";
homepage = "https://github.com/RfidResearchGroup/ChameleonUltra";
license = lib.licenses.gpl3Only;
mainProgram = "chameleon-cli";
maintainers = with lib.maintainers; [ azuwis ];
};
})