about summary refs log tree commit diff
path: root/pkgs/applications/misc/qelectrotech/default.nix
blob: b4d8bd3ab182b975f8d5b8887183a5afb3c4d7eb (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{ lib
, stdenv
, mkDerivation
, fetchzip
, installShellFiles
, pkg-config
, qmake
, qtbase
, kcoreaddons
, kwidgetsaddons
}:

mkDerivation rec {
  pname = "qelectrotech";
  version = "0.8.0";

  src = fetchzip {
    url = "https://git.tuxfamily.org/qet/qet.git/snapshot/qet-${version}.tar.gz";
    sha256 = "sha256-op2vnMPF9bNnHGphWFB/HEeoThE6tX+9UvX8LWVwkzI=";
  };

  postPatch = ''
    substituteInPlace qelectrotech.pro \
      --replace 'GIT_COMMIT_SHA="\\\"$(shell git -C \""$$_PRO_FILE_PWD_"\" rev-parse --verify HEAD)\\\""' \
                'GIT_COMMIT_SHA="\\\"${version}\\\""' \
      --replace "COMPIL_PREFIX              = '/usr/local/'" \
                "COMPIL_PREFIX              = '$out/'" \
      --replace "INSTALL_PREFIX             = '/usr/local/'" \
                "INSTALL_PREFIX             = '$out/'"
  '';

  nativeBuildInputs = [
    installShellFiles
    pkg-config
    qmake
  ];

  buildInputs = [
    kcoreaddons
    kwidgetsaddons
    qtbase
  ];

  qmakeFlags = [
    "INSTALLROOT=$(out)"
  ];

  installPhase = ''
    runHook preInstall

    install -Dm555 qelectrotech $out/bin/qelectrotech

    install -Dm444 -t $out/share/applications misc/qelectrotech.desktop
    install -Dm444 -t $out/share/applications misc/x-qet-titleblock.desktop
    install -Dm444 -t $out/share/applications misc/x-qet-element.desktop
    install -Dm444 -t $out/share/applications misc/x-qet-project.desktop

    mkdir -p $out/share/qelectrotech
    cp -r elements $out/share/qelectrotech
    cp -r titleblocks $out/share/qelectrotech
    cp -r lang $out/share/qelectrotech
    cp -r examples $out/share/qelectrotech

    mkdir -p $out/share/icons/hicolor
    cp -r ico $out/share/icons/hicolor

    runHook postInstall
  '';

  meta = with lib; {
    description = "Free software to create electric diagrams";
    mainProgram = "qelectrotech";
    homepage = "https://qelectrotech.org/";
    license = licenses.gpl2;
    maintainers = with maintainers; [ yvesf ];
    platforms = qtbase.meta.platforms;
    broken = stdenv.isDarwin;
  };
}