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