about summary refs log tree commit diff
path: root/pkgs/desktops/pantheon/apps/switchboard/wrapper.nix
blob: 2702b438f0ec2011cca112a9f174c8b697870a91 (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
{ wrapGAppsHook3
, glib
, lib
, stdenv
, xorg
, switchboard
, switchboardPlugs
, plugs
  # Only useful to disable for development testing.
, useDefaultPlugs ? true
, testName ? null
}:

let
  selectedPlugs =
    if plugs == null then switchboardPlugs
    else plugs ++ (lib.optionals useDefaultPlugs switchboardPlugs);

  testingName = lib.optionalString (testName != null) "${testName}-";
in
stdenv.mkDerivation rec {
  pname = "${testingName}${switchboard.pname}-with-plugs";
  inherit (switchboard) version;

  src = null;

  paths = [
    switchboard
  ] ++ selectedPlugs;

  passAsFile = [ "paths" ];

  nativeBuildInputs = [
    glib
    wrapGAppsHook3
  ];

  buildInputs = lib.forEach selectedPlugs (x: x.buildInputs)
    ++ selectedPlugs;

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

  preferLocalBuild = true;
  allowSubstitutes = false;

  installPhase = ''
    mkdir -p $out
    for i in $(cat $pathsPath); do
      ${xorg.lndir}/bin/lndir -silent $i $out
    done
  '';

  preFixup = ''
    gappsWrapperArgs+=(
      --set SWITCHBOARD_PLUGS_PATH "$out/lib/switchboard"
    )
  '';

  inherit (switchboard) meta;
}