@@ -0,0 +1,35 @@
1+{ stdenv, fetchFromGitHub, avrgcclibc, libelf, which, git, pkgconfig, freeglut
2+, mesa }:
3+
4+stdenv.mkDerivation rec {
5+ name = "simavr-${version}";
6+ version = "1.3";
7+ enableParallelBuilding = true;
8+
9+ src = fetchFromGitHub {
10+ owner = "buserror";
11+ repo = "simavr";
12+ rev = "51d5fa69f9bc3d62941827faec02f8fbc7e187ab";
13+ sha256 = "0k8xwzw9i6xsmf98q43fxhphq0wvflvmzqma1n4jd1ym9wi48lfx";
14+ };
15+
16+ buildFlags = "AVR_ROOT=${avrgcclibc}/avr SIMAVR_VERSION=${version}";
17+ installFlags = buildFlags + " DESTDIR=$(out)";
18+
19+ postFixup = ''
20+ target="$out/bin/simavr"
21+ patchelf --set-rpath "$(patchelf --print-rpath "$target"):$out/lib" "$target"
22+ '';
23+
24+ buildInputs = [ which git avrgcclibc libelf pkgconfig freeglut mesa ];
25+
26+ meta = with stdenv.lib; {
27+ description = "A lean and mean Atmel AVR simulator";
28+ homepage = https://github.com/buserror/simavr;
29+ license = licenses.gpl3;
30+ platforms = platforms.linux;
31+ maintainers = with maintainers; [ goodrone ];
32+ };
33+
34+}
35+