about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/virtualization/xe-guest-utilities/default.nix
blob: e1b89a562a8f125839b2e93e2538271ce4297e2f (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
{ lib
, buildGoModule
, fetchFromGitHub
, runtimeShell
}:

buildGoModule rec {
  pname = "xe-guest-utilities";
  version = "8.4.0";

  src = fetchFromGitHub {
    owner = "xenserver";
    repo = "xe-guest-utilities";
    rev = "v${version}";
    hash = "sha256-LpZx+Km2qRywYK/eFLP3aCDku6K6HC4+MzEODH+8Gvs=";
  };

  deleteVendor = true;
  vendorHash = "sha256-X/BI+ZhoqCGCmJfccyEBVgZc70aRTp3rL5j+rBWG5fE=";

  postPatch = ''
    substituteInPlace mk/xen-vcpu-hotplug.rules \
      --replace "/bin/sh" "${runtimeShell}"
  '';

  buildPhase = ''
    runHook preBuild

    make RELEASE=nixpkgs

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    install -Dt "$out"/bin build/stage/usr/{,s}bin/*
    install -Dt "$out"/etc/udev/rules.d build/stage/etc/udev/rules.d/*

    runHook postInstall
  '';

  meta = {
    description = "XenServer guest utilities";
    homepage = "https://github.com/xenserver/xe-guest-utilities";
    license = lib.licenses.bsd2;
    maintainers = with lib.maintainers; [ ];
    platforms = lib.platforms.linux;
  };
}