Unverified Commit dd984954 authored by Adam Stephens's avatar Adam Stephens
Browse files

lxd: add wrapper

parent d37f585a
Loading
Loading
Loading
Loading
+2 −27
Original line number Diff line number Diff line
@@ -4,35 +4,19 @@
, lxc
, buildGoModule
, fetchurl
, makeWrapper
, acl
, rsync
, gnutar
, xz
, btrfs-progs
, gzip
, dnsmasq
, attr
, squashfsTools
, iproute2
, iptables
, libcap
, dqlite
, raft-canonical
, sqlite
, udev
, writeShellScriptBin
, apparmor-profiles
, apparmor-parser
, criu
, bash
, installShellFiles
, nixosTests
, gitUpdater
}:

buildGoModule rec {
  pname = "lxd";
  pname = "lxd-unwrapped";
  version = "5.15";

  src = fetchurl {
@@ -52,7 +36,7 @@ buildGoModule rec {

  excludedPackages = [ "test" "lxd/db/generate" ];

  nativeBuildInputs = [ installShellFiles pkg-config makeWrapper ];
  nativeBuildInputs = [ installShellFiles pkg-config ];
  buildInputs = [
    lxc
    acl
@@ -85,15 +69,6 @@ buildGoModule rec {
    '';

  postInstall = ''
    wrapProgram $out/bin/lxd --prefix PATH : ${lib.makeBinPath (
      [ iptables ]
      ++ [ acl rsync gnutar xz btrfs-progs gzip dnsmasq squashfsTools iproute2 bash criu attr ]
      ++ [ (writeShellScriptBin "apparmor_parser" ''
             exec '${apparmor-parser}/bin/apparmor_parser' -I '${apparmor-profiles}/etc/apparmor.d' "$@"
           '') ]
      )
    }

    installShellCompletion --bash --name lxd ./scripts/bash/lxd-client
  '';

+60 −0
Original line number Diff line number Diff line
{ 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;
}
+2 −1
Original line number Diff line number Diff line
@@ -10126,7 +10126,8 @@ with pkgs;
    autoreconfHook = buildPackages.autoreconfHook269;
  };
  lxcfs = callPackage ../os-specific/linux/lxcfs { };
  lxd = callPackage ../tools/admin/lxd { };
  lxd = callPackage ../tools/admin/lxd/wrapper.nix { };
  lxd-unwrapped = callPackage ../tools/admin/lxd { };
  lxd-image-server = callPackage ../tools/virtualization/lxd-image-server { };