summary refs log tree commit diff
path: root/pkgs/applications/graphics/leocad/default.nix
blob: bb37dc5ef0275c7493c1cbf7ca8a5450acb3bc45 (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
59
60
61
62
63
64
{ lib
, mkDerivation
, fetchFromGitHub
, fetchurl
, povray
, qmake
, qttools
, substituteAll
, zlib
}:

/*
To use aditional parts libraries
set the variable LEOCAD_LIB=/path/to/libs/ or use option -l /path/to/libs/
*/

let
  parts = fetchurl {
    url = "https://web.archive.org/web/20210705153544/https://www.ldraw.org/library/updates/complete.zip";
    sha256 = "sha256-PW3XCbFwRaNkx4EgCnl2rXH7QgmpNgjTi17kZ5bladA=";
  };

in
mkDerivation rec {
  pname = "leocad";
  version = "21.06";

  src = fetchFromGitHub {
    owner = "leozide";
    repo = "leocad";
    rev = "v${version}";
    sha256 = "1ifbxngkbmg6d8vv08amxbnfvlyjdwzykrjp98lbwvgb0b843ygq";
  };

  nativeBuildInputs = [ qmake qttools ];

  buildInputs = [ zlib ];

  propagatedBuildInputs = [ povray ];

  patches = [
    (substituteAll {
      src = ./povray.patch;
      inherit povray;
    })
  ];

  qmakeFlags = [
    "INSTALL_PREFIX=${placeholder "out"}"
    "DISABLE_UPDATE_CHECK=1"
  ];

  qtWrapperArgs = [
    "--set-default LEOCAD_LIB ${parts}"
  ];

  meta = with lib; {
    description = "CAD program for creating virtual LEGO models";
    homepage = "https://www.leocad.org/";
    license = licenses.gpl2Only;
    maintainers = with maintainers; [ peterhoeg ];
    platforms = platforms.linux;
  };
}