about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/virtualization/xhyve/default.nix
blob: db9a7ef825771ee01d36febc99e6845ebff01e71 (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
{ stdenv, lib, fetchFromGitHub, Hypervisor, vmnet, xpc, libobjc, zlib }:

stdenv.mkDerivation rec {
  pname = "xhyve";
  version = "20191001";

  src = fetchFromGitHub {
    owner = "machyve";
    repo = "xhyve";
    rev = "1f46a3d0bbeb6c90883f302425844fcc3800a776";
    sha256 = "0mm9xa0v6n7xl2qypnppq5abdncd31vffiklrhcrlni5ymyh9ia5";
  };

  buildInputs = [ Hypervisor vmnet xpc libobjc zlib ];

  # Don't use git to determine version
  prePatch = ''
    substituteInPlace Makefile \
      --replace 'shell git describe --abbrev=6 --dirty --always --tags' "$version"
  '';


  makeFlags = [ "CFLAGS+=-Wno-shift-sign-overflow" ''CFLAGS+=-DVERSION=\"${version}\"'' ];

  installPhase = ''
    mkdir -p $out/bin
    cp build/xhyve $out/bin
  '';

  meta = with lib; {
    description = "Lightweight Virtualization on macOS Based on bhyve";
    homepage = "https://github.com/mist64/xhyve";
    maintainers = [ maintainers.lnl7 ];
    license = licenses.bsd2;
    platforms = platforms.darwin;
  };
}