nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 makeSetupHook,
5 fetchFromGitHub,
6 libelf,
7 which,
8 pkg-config,
9 libglut,
10 avrgcc,
11 avrlibc,
12 libGLU,
13 libGL,
14}:
15
16let
17 setupHookDarwin = makeSetupHook {
18 name = "darwin-avr-gcc-hook";
19 substitutions = {
20 darwinSuffixSalt = stdenv.cc.suffixSalt;
21 avrSuffixSalt = avrgcc.suffixSalt;
22 };
23 } ./setup-hook-darwin.sh;
24
25in
26stdenv.mkDerivation rec {
27 pname = "simavr";
28 version = "1.7";
29
30 src = fetchFromGitHub {
31 owner = "buserror";
32 repo = "simavr";
33 rev = "v${version}";
34 sha256 = "0njz03lkw5374x1lxrq08irz4b86lzj2hibx46ssp7zv712pq55q";
35 };
36
37 makeFlags = [
38 "DESTDIR=$(out)"
39 "PREFIX="
40 "AVR_ROOT=${avrlibc}/avr"
41 "SIMAVR_VERSION=${version}"
42 "AVR=avr-"
43 ];
44
45 nativeBuildInputs = [
46 which
47 pkg-config
48 avrgcc
49 ]
50 ++ lib.optional stdenv.hostPlatform.isDarwin setupHookDarwin;
51 buildInputs = [
52 libelf
53 libglut
54 libGLU
55 libGL
56 ];
57
58 # remove forbidden references to $TMPDIR
59 preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
60 patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$out"/bin/*
61 '';
62
63 doCheck = true;
64 checkTarget = "-C tests run_tests";
65
66 meta = {
67 description = "Lean and mean Atmel AVR simulator";
68 mainProgram = "simavr";
69 homepage = "https://github.com/buserror/simavr";
70 license = lib.licenses.gpl3;
71 platforms = lib.platforms.unix;
72
73 maintainers = with lib.maintainers; [
74 goodrone
75 patryk27
76 ];
77 };
78}