summary refs log tree commit diff
path: root/pkgs/tools/misc/kisslicer/default.nix
blob: 5e5a7174a149712bf61704af6cab69abcc473861 (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
{ fetchzip
, libX11
, libGLU, libGL
, makeWrapper
, stdenv
}:

let

  libPath = stdenv.lib.makeLibraryPath [
    libGLU libGL
    stdenv.cc.cc
    libX11
  ];

  inidir = "\\\${XDG_CONFIG_HOME:-\\$HOME/.config}/kisslicer";

in

stdenv.mkDerivation {
  name = "kisslicer-1.6.3";

  src = fetchzip {
    url = "http://www.kisslicer.com/uploads/1/5/3/8/15381852/kisslicer_linux64_1.6.3_release.zip";
    sha256 = "1xmywj5jrcsqv1d5x3mphhvafs4mfm9l12npkhk7l03qxbwg9j82";
    stripRoot = false;
  };

  phases = [ "unpackPhase" "installPhase" "fixupPhase" ];

  buildInputs = [
    makeWrapper
    libGLU libGL
    libX11
  ];

  installPhase = ''
    mkdir -p $out/bin
    cp -p * $out/bin
  '';

  fixupPhase = ''
    chmod 755 $out/bin/KISSlicer
    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
      --set-rpath ${libPath}   $out/bin/KISSlicer
    wrapProgram $out/bin/KISSlicer \
      --add-flags "-inidir ${inidir}" \
      --run "mkdir -p ${inidir}"
  '';

  meta = with stdenv.lib; {
    description = "Convert STL files into Gcode";
    homepage = http://www.kisslicer.com;
    license = licenses.unfree;
    maintainers = [ maintainers.cransom ];
    platforms = [ "x86_64-linux" ];
  };
}