summary refs log tree commit diff
path: root/pkgs/applications/misc/avrdudess/default.nix
blob: f4a56e4f92403d96271c74c0deb2b28713c5aa4f (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
{ stdenv, runtimeShell, fetchurl, unzip, mono, avrdude, gtk2, xdg_utils }:

stdenv.mkDerivation {
  name = "avrdudess-2.2.20140102";

  src = fetchurl {
    url = "http://blog.zakkemble.co.uk/download/avrdudess_20140102.zip";
    sha256 = "18llpvjsfhypzijrvfbzmcg3g141f307mzsrg11wcdxh9syxqak6";
  };

  buildInputs = [ unzip ];

  phases = [ "buildPhase" ];

  buildPhase = ''
    mkdir -p "$out/avrdudess"
    mkdir -p "$out/bin"

    unzip "$src" -d "$out/avrdudess"

    cat >> "$out/bin/avrdudess" << __EOF__
    #!${runtimeShell}
    export LD_LIBRARY_PATH="${stdenv.lib.makeLibraryPath [gtk2 mono]}"
    # We need PATH from user env for xdg-open to find its tools, which
    # typically depend on the currently running desktop environment.
    export PATH="${stdenv.lib.makeBinPath [ avrdude xdg_utils ]}:\$PATH"

    # avrdudess must have its resource files in its current working directory
    cd $out/avrdudess && exec ${mono}/bin/mono "$out/avrdudess/avrdudess.exe" "\$@"
    __EOF__

    chmod a+x "$out/bin/"*
  '';

  meta = with stdenv.lib; {
    description = "GUI for AVRDUDE (AVR microcontroller programmer)";
    homepage = "https://github.com/zkemble/AVRDUDESS";
    license = licenses.gpl3;
    platforms = platforms.linux;
    maintainers = [ maintainers.bjornfor ];
  };
}