1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 ffmpeg,
6 python3Packages,
7 qt6Packages,
8 testers,
9 corrscope,
10}:
11
12python3Packages.buildPythonApplication rec {
13 pname = "corrscope";
14 version = "0.11.0";
15 pyproject = true;
16
17 src = fetchFromGitHub {
18 owner = "corrscope";
19 repo = "corrscope";
20 tag = version;
21 hash = "sha256-76qa4jOSncK1eDly/uXJzpWWdsEz7Hg3DyFb7rmrQBc=";
22 };
23
24 nativeBuildInputs = with qt6Packages; [
25 wrapQtAppsHook
26 ];
27
28 build-system = with python3Packages; [
29 hatchling
30 ];
31
32 buildInputs = [
33 ffmpeg
34 ]
35 ++ (
36 with qt6Packages;
37 [
38 qtbase
39 ]
40 ++ lib.optionals stdenv.hostPlatform.isLinux [
41 qtwayland
42 ]
43 );
44
45 dependencies = (
46 with python3Packages;
47 [
48 appdirs
49 atomicwrites
50 attrs
51 click
52 colorspacious
53 matplotlib
54 numpy
55 qtpy
56 pyqt6
57 ruamel-yaml
58 ]
59 ++ lib.optionals stdenv.hostPlatform.isDarwin [
60 appnope
61 ]
62 );
63
64 dontWrapQtApps = true;
65
66 preFixup = ''
67 makeWrapperArgs+=(
68 --prefix PATH : ${lib.makeBinPath [ ffmpeg ]}
69 "''${qtWrapperArgs[@]}"
70 )
71 '';
72
73 passthru.tests.version = testers.testVersion {
74 package = corrscope;
75 # Tries writing to
76 # - $HOME/.local/share/corrscope on Linux
77 # - $HOME/Library/Application Support/corrscope on Darwin
78 command = "env HOME=$TMPDIR ${lib.getExe corrscope} --version";
79 };
80
81 meta = {
82 description = "Render wave files into oscilloscope views, featuring advanced correlation-based triggering algorithm";
83 longDescription = ''
84 Corrscope renders oscilloscope views of WAV files recorded from chiptune (game music from
85 retro sound chips).
86
87 Corrscope uses "waveform correlation" to track complex waves (including SNES and Sega
88 Genesis/FM synthesis) which jump around on other oscilloscope programs.
89 '';
90 homepage = "https://github.com/corrscope/corrscope";
91 changelog = "https://github.com/corrscope/corrscope/releases/tag/${version}";
92 license = lib.licenses.bsd2;
93 maintainers = with lib.maintainers; [ OPNA2608 ];
94 platforms = lib.platforms.all;
95 mainProgram = "corr";
96 };
97}