nixos/derivations/ddt4all.nix
2025-02-06 11:58:03 +01:00

60 lines
1.3 KiB
Nix

{ mkDerivation,
lib,
stdenv,
fetchFromGitHub,
python3,
qtbase,
qttools,
wrapQtAppsHook,
git,
which,
}:
let
myPython = python3.withPackages (pkgs: with pkgs; [ pyqt5 pyqtwebengine pyusb crcmod pyserial ]);
in
mkDerivation rec {
pname = "ddt4all";
version = "1.0.0"; # Replace with the actual version if necessary
src = fetchFromGitHub {
owner = "cedricp";
repo = "ddt4all";
rev = "master";
sha256 = "sha256-EX7cobgxM8/o4cRmfMMDSYG9X9Av6zmoWlSv1nzfl5o=";
};
# If necessary, add patches to the source
# patches = [ ./some_patch.patch ];
nativeBuildInputs = [
myPython
wrapQtAppsHook # This is useful for Qt apps
qttools # Required for Qt applications
which # For locating binaries (e.g., python3)
];
propagatedBuildInputs = [
myPython
qtbase
qttools
];
#makeFlags = [ "PREFIX=$(out)" ];
runScript = ''
# Set up environment for running the app
export LD_LIBRARY_PATH=${qtbase}/lib:${myPython}/lib:$LD_LIBRARY_PATH
if [ ! -d ".venv" ]; then
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
else
source .venv/bin/activate
fi
# Run the application
python3 main.py
'';
}