summary refs log tree commit diff
path: root/pkgs/tools/admin/lxd/wrapper.nix
blob: 55b721ed24b31d8bf12ec9b69d5c1f0671c957ad (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
{ lib
, lxd-unwrapped
, makeWrapper
, symlinkJoin
, writeShellScriptBin
, acl
, apparmor-parser
, apparmor-profiles
, attr
, bash
, btrfs-progs
, criu
, dnsmasq
, gnutar
, gzip
, iproute2
, iptables
, rsync
, squashfsTools
, xz
,
}:
let
  binPath = lib.makeBinPath [
    acl
    attr
    bash
    btrfs-progs
    criu
    dnsmasq
    gnutar
    gzip
    iproute2
    iptables
    rsync
    squashfsTools
    xz

    (writeShellScriptBin "apparmor_parser" ''
      exec '${apparmor-parser}/bin/apparmor_parser' -I '${apparmor-profiles}/etc/apparmor.d' "$@"
    '')
  ];
in
symlinkJoin {
  name = "lxd-${lxd-unwrapped.version}";

  paths = [ lxd-unwrapped ];

  nativeBuildInputs = [ makeWrapper ];

  postBuild = ''
    wrapProgram $out/bin/lxd --prefix PATH : ${lib.escapeShellArg binPath}
  '';

  passthru = {
    inherit (lxd-unwrapped) tests;
  };

  inherit (lxd-unwrapped) meta pname version;
}