about summary refs log tree commit diff
path: root/pkgs/applications/science/electronics/simulide/default.nix
blob: 1b5b3d572128a2c372177a5ecdef59b117b9e5ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{ lib
, fetchbzr
, mkDerivation
, qmake
, qtserialport
, qtmultimedia
, qttools
, qtscript
}:

let
  version = "0.4.15";
  release = "SR10";
  branch = "simulide_0.4.14"; # the branch name does not mach the version for some reason
  rev = "291";
  sha256 = "sha256-BBoZr/S2pif0Jft5wrem8y00dXl08jq3kFiIUtOr3LM=";
in
mkDerivation {
  pname = "simulide";
  version = "${version}-${release}";

  src = fetchbzr {
    url = "https://code.launchpad.net/~arcachofo/simulide/${branch}";
    inherit rev sha256;
  };

  postPatch = ''
    # GCC 13 needs this header explicitly included
    sed -i src/gpsim/value.h -e '1i #include <cstdint>'
    sed -i src/gpsim/modules/watchdog.h -e '1i #include <cstdint>'

    sed -i resources/simulide.desktop \
      -e "s|^Exec=.*$|Exec=simulide|" \
      -e "s|^Icon=.*$|Icon=simulide|"
    sed -i SimulIDE.pro \
      -e "s|^VERSION = .*$|VERSION = ${version}|" \
      -e "s|^RELEASE = .*$|RELEASE = -${release}|" \
      -e "s|^REV_NO = .*$|REV_NO = ${rev}|" \
      -e "s|^BUILD_DATE = .*$|BUILD_DATE = ??-??-??|"
  '';

  preConfigure = ''
    cd build_XX
  '';

  nativeBuildInputs = [
    qmake
  ];

  buildInputs = [
    qtserialport
    qtmultimedia
    qttools
    qtscript
  ];

  installPhase = ''
    runHook preInstall

    install -Dm644 ../resources/simulide.desktop $out/share/applications/simulide.desktop
    install -Dm644 ../resources/icons/hicolor/256x256/simulide.png $out/share/icons/hicolor/256x256/apps/simulide.png

    mkdir -p $out/share/simulide $out/bin

    pushd executables/SimulIDE_*
    cp -r share/simulide/* $out/share/simulide
    cp bin/simulide $out/bin/simulide
    popd

    runHook postInstall
  '';

  meta = with lib; {
    description = "A simple real time electronic circuit simulator";
    longDescription = ''
      SimulIDE is a simple real time electronic circuit simulator, intended for hobbyist or students
      to learn and experiment with analog and digital electronic circuits and microcontrollers.
      It supports PIC, AVR, Arduino and other MCUs and MPUs.
    '';
    homepage = "https://simulide.com/";
    license = licenses.gpl3Only;
    mainProgram = "simulide";
    maintainers = with maintainers; [ carloscraveiro tomasajt ];
    platforms = ["x86_64-linux"];
  };
}