nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, boost
3, fetchFromGitHub
4, installShellFiles
5, mkDerivation
6, muparser
7, pkg-config
8, qmake
9, qtbase
10, qtsvg
11, qttools
12, runtimeShell
13}:
14
15mkDerivation rec {
16 pname = "librecad";
17 version = "2.2.0";
18
19 src = fetchFromGitHub {
20 owner = "LibreCAD";
21 repo = "LibreCAD";
22 rev = version;
23 sha256 = "sha256-horKTegmvcMg4m5NbZ4nzy4J6Ac/6+E5OkiZl0v6TBc=";
24 };
25
26 buildInputs = [
27 boost
28 muparser
29 qtbase
30 qtsvg
31 ];
32
33 nativeBuildInputs = [
34 installShellFiles
35 pkg-config
36 qmake
37 qttools
38 ];
39
40 qmakeFlags = [
41 "MUPARSER_DIR=${muparser}"
42 "BOOST_DIR=${boost.dev}"
43 ];
44
45 postPatch = ''
46 substituteInPlace scripts/postprocess-unix.sh \
47 --replace /bin/sh ${runtimeShell}
48
49 substituteInPlace librecad/src/main/qc_applicationwindow.cpp \
50 --replace __DATE__ 0
51 '';
52
53
54 installPhase = ''
55 runHook preInstall
56
57 install -Dm555 -t $out/bin unix/{librecad,ttf2lff}
58 install -Dm444 -t $out/share/applications desktop/librecad.desktop
59 install -Dm644 -t $out/share/pixmaps librecad/res/main/librecad.png
60 install -Dm444 desktop/librecad.sharedmimeinfo $out/share/mime/packages/librecad.xml
61 install -Dm444 desktop/graphics_icons_and_splash/Icon\ LibreCAD/Icon_Librecad.svg \
62 $out/share/icons/hicolor/scalable/apps/librecad.svg
63
64 installManPage desktop/librecad.?
65
66 cp -R unix/resources $out/share/librecad
67
68 runHook postInstall
69 '';
70
71 meta = with lib; {
72 description = "2D CAD package based on Qt";
73 homepage = "https://librecad.org";
74 license = licenses.gpl2Only;
75 maintainers = with maintainers; [ kiwi viric ];
76 platforms = platforms.linux;
77 };
78}