-
-
Notifications
You must be signed in to change notification settings - Fork 17.8k
labrador: init at 0-unstable-2026-01-05 #477199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
718d801
66edf24
1080df1
626255d
96be831
a7f1a02
8260d6f
c0bec2c
6b40d49
def8211
2f9db0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,129 @@ | ||||||
| { | ||||||
| lib, | ||||||
| stdenv, | ||||||
| fetchFromGitHub, | ||||||
| pkg-config, | ||||||
| qt5, | ||||||
| libusb1, | ||||||
| fftw, | ||||||
| fftwFloat, | ||||||
| eigen, | ||||||
| llvmPackages, | ||||||
| }: | ||||||
|
|
||||||
| let | ||||||
| # Map Nix system to the architecture names used in bundled libdfuprog | ||||||
| dfuprogArch = | ||||||
| { | ||||||
| "x86_64-linux" = "x86_64"; | ||||||
| "aarch64-linux" = "arm64"; | ||||||
| "i686-linux" = "i386"; | ||||||
| "armv7l-linux" = "arm"; | ||||||
| } | ||||||
| .${stdenv.hostPlatform.system} or (throw "labrador: unsupported system ${stdenv.hostPlatform.system}"); | ||||||
|
|
||||||
|
|
||||||
| libExt = stdenv.hostPlatform.extensions.sharedLibrary; | ||||||
| # Build directory differs between platforms | ||||||
| buildDir = if stdenv.hostPlatform.isDarwin then "build_mac" else "build_linux"; | ||||||
| in | ||||||
| stdenv.mkDerivation { | ||||||
| pname = "labrador"; | ||||||
| version = "0-unstable-2026-01-05"; | ||||||
|
|
||||||
| src = fetchFromGitHub { | ||||||
| owner = "espotek-org"; | ||||||
| repo = "Labrador"; | ||||||
| rev = "3119205cdde183039062621c1204584f1ec1c5ac"; | ||||||
| hash = "sha256-GREfHgwRk6qTWEG8kVVP2v7X28L5x9vIsBmziOTNpvQ="; | ||||||
| }; | ||||||
|
|
||||||
| nativeBuildInputs = [ | ||||||
| pkg-config | ||||||
| qt5.wrapQtAppsHook | ||||||
| qt5.qmake | ||||||
| ]; | ||||||
|
|
||||||
| buildInputs = [ | ||||||
| qt5.qtbase | ||||||
| libusb1 | ||||||
| fftw | ||||||
| fftwFloat | ||||||
| eigen | ||||||
| llvmPackages.openmp | ||||||
| ]; | ||||||
|
|
||||||
| preConfigure = '' | ||||||
| cd Desktop_Interface | ||||||
|
|
||||||
| # Create library directory for bundled libdfuprog | ||||||
| mkdir -p $out/lib | ||||||
|
|
||||||
| # Copy the appropriate libdfuprog for this platform/architecture | ||||||
| ${ | ||||||
| if stdenv.hostPlatform.isDarwin then | ||||||
| '' | ||||||
| cp ${buildDir}/libdfuprog/lib/libdfuprog-0.9${libExt} $out/lib/ | ||||||
| '' | ||||||
| else | ||||||
| '' | ||||||
| cp ${buildDir}/libdfuprog/lib/${dfuprogArch}/libdfuprog-0.9${libExt} $out/lib/ | ||||||
| '' | ||||||
| } | ||||||
| ''; | ||||||
|
|
||||||
| installPhase = '' | ||||||
| runHook preInstall | ||||||
|
|
||||||
| # Install binary (name differs on macOS) | ||||||
| mkdir -p $out/bin | ||||||
| if [ -f labrador ]; then | ||||||
| cp labrador $out/bin/ | ||||||
| elif [ -f Labrador ]; then | ||||||
| cp Labrador $out/bin/labrador | ||||||
| fi | ||||||
|
|
||||||
| mkdir -p $out/share/EspoTek/Labrador/firmware | ||||||
| cp resources/firmware/labrafirm* $out/share/EspoTek/Labrador/firmware/ | ||||||
|
|
||||||
| mkdir -p $out/share/EspoTek/Labrador/waveforms | ||||||
| cp resources/waveforms/* $out/share/EspoTek/Labrador/waveforms/ | ||||||
|
|
||||||
| ${lib.optionalString stdenv.hostPlatform.isLinux '' | ||||||
| mkdir -p $out/share/icons/hicolor/{48x48,256x256}/apps | ||||||
| cp build_linux/icon48/espotek-labrador.png $out/share/icons/hicolor/48x48/apps/ | ||||||
| cp build_linux/icon256/espotek-labrador.png $out/share/icons/hicolor/256x256/apps/ | ||||||
|
|
||||||
| mkdir -p $out/share/applications | ||||||
| cp build_linux/espotek-labrador.desktop $out/share/applications/ | ||||||
| ''} | ||||||
|
|
||||||
| runHook postInstall | ||||||
| ''; | ||||||
|
|
||||||
| # Wrap the executable to find libdfuprog | ||||||
| preFixup = | ||||||
| if stdenv.hostPlatform.isDarwin then | ||||||
| '' | ||||||
| qtWrapperArgs+=(--prefix DYLD_LIBRARY_PATH : "$out/lib") | ||||||
| '' | ||||||
| else | ||||||
| '' | ||||||
| qtWrapperArgs+=(--prefix LD_LIBRARY_PATH : "$out/lib") | ||||||
| ''; | ||||||
|
|
||||||
| meta = { | ||||||
| description = "EspoTek Labrador - oscilloscope, signal generator, logic analyzer, and more"; | ||||||
| longDescription = '' | ||||||
| The EspoTek Labrador is an open-source board that turns your PC into a | ||||||
| full-featured electronics lab bench, complete with oscilloscope, signal | ||||||
| generator, logic analyzer, and more. This package provides the Qt5 | ||||||
| desktop application for interfacing with the Labrador hardware. | ||||||
| ''; | ||||||
| homepage = "https://github.com/espotek-org/Labrador"; | ||||||
| license = lib.licenses.gpl3Only; | ||||||
| # maintainers = with lib.maintainers; [ randomizedcoder ]; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, my github name hasn't landed in https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix yet. Once it does, I can add this line. ( Speaking of which, this maintainer-list.nix is very large. I wonder if it should be split by subdirs "aa" ... ? ) |
||||||
| platforms = lib.platforms.linux ++ lib.platforms.darwin; | ||||||
| mainProgram = "labrador"; | ||||||
| }; | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If by some strange behavior neither matches, we would not install anything. Since we know the condition beforehand, we should absolutely use that.