about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/av/avr-sim/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/by-name/av/avr-sim/package.nix')
-rw-r--r--nixpkgs/pkgs/by-name/av/avr-sim/package.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/by-name/av/avr-sim/package.nix b/nixpkgs/pkgs/by-name/av/avr-sim/package.nix
new file mode 100644
index 000000000000..8afb4d902bb8
--- /dev/null
+++ b/nixpkgs/pkgs/by-name/av/avr-sim/package.nix
@@ -0,0 +1,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];
+  };
+}