about summary refs log tree commit diff
path: root/pkgs/desktops/lomiri/applications/lomiri-system-settings/wrapper.nix
blob: 682001b62eea8185dbee7a554bc72741cfee5019 (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
{ stdenvNoCC
, lib
, nixosTests
, glib
, lndir
, lomiri-system-settings-unwrapped
, lomiri-system-settings-security-privacy
, wrapGAppsHook3
, wrapQtAppsHook
, plugins ? [ lomiri-system-settings-security-privacy ]
}:

stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "lomiri-system-settings";
  inherit (lomiri-system-settings-unwrapped) version;

  dontUnpack = true;
  dontConfigure = true;
  dontBuild = true;

  strictDeps = true;

  nativeBuildInputs = [
    lndir
    wrapGAppsHook3
    wrapQtAppsHook
  ];

  buildInputs = [
    glib # schema hook
    lomiri-system-settings-unwrapped
  ] ++ plugins;

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    ln -s ${lib.getExe lomiri-system-settings-unwrapped} $out/bin/${finalAttrs.meta.mainProgram}

    for inheritedPath in share/lomiri-app-launch share/lomiri-url-dispatcher share/applications share/icons; do
      mkdir -p $out/$inheritedPath
      lndir ${lomiri-system-settings-unwrapped}/$inheritedPath $out/$inheritedPath
    done

    for mergedPath in lib/lomiri-system-settings share/lomiri-system-settings share/locale; do
      mkdir -p $out/$mergedPath
      for lssPart in ${lomiri-system-settings-unwrapped} ${lib.strings.concatStringsSep " " plugins}; do
        lndir $lssPart/$mergedPath $out/$mergedPath
      done
    done

    runHook postInstall
  '';

  dontWrapGApps = true;

  preFixup = ''
    qtWrapperArgs+=(
      "''${gappsWrapperArgs[@]}"
      --set NIX_LSS_PREFIX "$out"
    )
  '';

  passthru.tests.standalone = nixosTests.lomiri-system-settings;

  meta = lomiri-system-settings-unwrapped.meta // {
    description = "System Settings application for Lomiri (wrapped)";
    priority = (lomiri-system-settings-unwrapped.meta.priority or 0) - 1;
  };
})