about summary refs log tree commit diff
path: root/pkgs/by-name/av/avr-sim/package.nix
blob: 8afb4d902bb831c4968efc0a13e78d78314e5e3a (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
{
  lib,
  stdenv,
  fetchzip,
  lazarus,
  fpc,
  pango,
  cairo,
  glib,
  atk,
  gtk2,
  libX11,
  gdk-pixbuf,
}:
stdenv.mkDerivation rec {
  pname = "avr-sim";
  version = "2.8";

  # Unfortunately old releases get removed:
  # http://www.avr-asm-tutorial.net/avr_sim/avr_sim-download.html
  # Therefore, fallback to an archive.org snapshot
  src = fetchzip {
    urls = [
      "http://www.avr-asm-tutorial.net/avr_sim/28/avr_sim_28_lin_src.zip"
      "https://web.archive.org/web/20231129125754/http://www.avr-asm-tutorial.net/avr_sim/28/avr_sim_28_lin_src.zip"
    ];
    sha256 = "sha256-7MgUzMs+l+3RVUbORAWyU1OUpgrKIeWhS+ObgRJtOHc=";
  };

  nativeBuildInputs = [lazarus fpc];

  buildInputs = [pango cairo glib atk gtk2 libX11 gdk-pixbuf];

  NIX_LDFLAGS = "--as-needed -rpath ${lib.makeLibraryPath buildInputs}";

  buildPhase = ''
    runHook preBuild

    lazbuild --lazarusdir=${lazarus}/share/lazarus --build-mode=Release avr_sim.lpi

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin

    cp avr_sim $out/bin

    runHook postInstall
  '';

  meta = with lib; {
    description = "AVR assembler simulator for the stepwise execution of assembler source code - with many extras";
    homepage = "http://www.avr-asm-tutorial.net/avr_sim/index_en.html";
    license = licenses.unfree;
    platforms = platforms.unix;
    maintainers = with maintainers; [ameer];
  };
}