summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/ef/efibooteditor/package.nix
blob: 83988283f46a9e3a31fbffe019b619b4e675307d (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
{
  lib,
  qt6,
  zlib,
  cmake,
  efivar,
  pkg-config,
  fetchFromGitHub,
  stdenv,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "efibooteditor";
  version = "1.5.5";

  src = fetchFromGitHub {
    owner = "Neverous";
    repo = "efibooteditor";
    tag = "v${finalAttrs.version}";
    hash = "sha256-OtNZA2K6Kr4IHnTw0i+evHJmBx9oAGKuU90XtUfXKy0=";
  };

  buildInputs = [ zlib ] ++ lib.optional stdenv.hostPlatform.isLinux efivar;

  nativeBuildInputs = [
    cmake
    pkg-config
    qt6.qttools
    qt6.wrapQtAppsHook
  ];

  postPatch = ''
    substituteInPlace misc/org.x.efibooteditor.policy \
      --replace-fail /usr/bin $out/bin
    substituteInPlace misc/EFIBootEditor.desktop \
      --replace-fail "1.0" ${finalAttrs.version} \
      --replace-fail \
        'pkexec efibooteditor' \
        'sh -c "pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY efibooteditor"'
  '';

  env = {
    LANG = "C.UTF8";
    BUILD_VERSION = "v${finalAttrs.version}";
  };

  cmakeBuildType = "MinSizeRel";
  cmakeFlags = [ "-DQT_VERSION_MAJOR=6" ];

  postInstall = ''
    install -Dm644 $src/LICENSE.txt $out/share/licenses/efibooteditor/LICENSE
  '';

  doCheck = true;
  checkPhase = ''
    runHook preCheck

    ctest --output-on-failure

    runHook postCheck
  '';

  meta = {
    description = "Boot Editor for (U)EFI based systems";
    homepage = "https://github.com/Neverous/efibooteditor";
    changelog = "https://github.com/Neverous/efibooteditor/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.lgpl3Plus;
    platforms = lib.platforms.linux; # TODO build is broken on darwin
    maintainers = with lib.maintainers; [ phanirithvij ];
    mainProgram = "efibooteditor";
  };
})