summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/e5/e57inspector/package.nix
blob: 3b9305bc3af6dfb638dd038476953c7207718b55 (plain)
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,
  fetchFromGitHub,
  fetchpatch,
  cmake,
  qt6,
  xercesc,
  nixosTests,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "e57inspector";
  version = "0.3.1";

  src = fetchFromGitHub {
    owner = "sisakat";
    repo = "e57inspector";
    tag = "v${finalAttrs.version}";
    hash = "sha256-McLPbvS7j+6UVEcQ34/ngGiCxsdF/Whs5wZt5cP2UkI=";
    fetchSubmodules = true;
  };

  strictDeps = true;
  __structuredAttrs = true;

  patches = [
    # Support loading E57 files from CLI arguments,
    # so we can use that in the NixOS VM test to load a sample file.
    # Remove with next release (see https://github.com/sisakat/e57inspector/pull/8)
    (fetchpatch {
      name = "e57inspector-Allow-loading-file-from-CLI.patch";
      url = "https://github.com/nh2/e57inspector/commit/a5a899ee58952ffc2971d18b3734ea405e0020f3.patch";
      hash = "sha256-QRUv0CvX+OdH88CzI/6XjPXnAVIsf6N/Ix/qqCsSaRw=";
    })
  ];

  postPatch = ''
    # Fix cmake_minimum_required version compatibility with CMake >= 4.0
    substituteInPlace app/cmake/gitversion.cmake \
      --replace-fail "cmake_minimum_required(VERSION 3.0.0)" "cmake_minimum_required(VERSION 3.5)"
  '';

  nativeBuildInputs = [
    cmake
    qt6.wrapQtAppsHook
  ];

  buildInputs = [
    qt6.qtbase
    qt6.qttools
    xercesc
  ];

  # Upstream CMakeLists.txt has no install() rules.
  installPhase = ''
    runHook preInstall

    install -Dm755 app/e57inspector -t $out/bin
    install -Dm755 panorama/e57inspector_panorama -t $out/bin

    runHook postInstall
  '';

  passthru.tests = nixosTests.e57inspector;

  meta = {
    description = "Cross-platform E57 file viewer to list and view stored point clouds, images and metadata";
    homepage = "https://github.com/sisakat/e57inspector";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [
      nh2
      chpatrick
    ];
    teams = [ lib.teams.geospatial ];
    platforms = lib.platforms.linux;
    mainProgram = "e57inspector";
  };
})