infra-vintage/vmtools/pkgs/triton-vmtools.nix

55 lines
1.4 KiB
Nix

{ pkgs, ... }:
with pkgs;
stdenv.mkDerivation rec {
pname = "triton-vmtools";
version = "0.0.1";
src = fetchFromGitHub {
owner = "TritonDataCenter";
repo = "sdc-vmtools";
rev = "664539f808786bc71a2ab566f663fd25b8c12140";
sha256 = "sha256-RI1iqRvjSEPVJob0Y20/eJ8AmObhXP6Nn9b1Vv1cCO4=";
};
PATH = lib.makeBinPath nativeBuildInputs;
nativeBuildInputs = [
autoPatchelfHook
coreutils
e2fsprogs
inetutils
iputils
policycoreutils
util-linux
parted
];
patches = [
./0001-fix-paths-in-scripts.patch
];
installPhase = ''
sdcvmtools="src/linux"
mkdir -p $out/bin $out/lib $out/share/man/man1
cp -r ''${sdcvmtools}/lib/smartdc $out/lib/
cp -r ''${sdcvmtools}/usr/sbin/mdata-* $out/bin/
cp -r ''${sdcvmtools}/usr/share/man/man1/mdata-* $out/share/man/man1/
for file in $out/lib/smartdc/*
do
substituteInPlace ''$file \
--replace "/__replace_lib/" "$out/lib/"
substituteInPlace ''$file \
--replace "/__replace_lib/" "$out/lib/"
done
substituteInPlace $out/lib/smartdc/lib_smartdc_scripts.cfg \
--replace "/usr/sbin/" "$out/bin/"
'';
meta = with lib; {
description = "The VM Guest tools contains scripts and drivers that are used to create virtualized machine images in SmartOS.";
homepage = "https://github.com/TritonDataCenter/sdc-vmtools";
license = licenses.mit;
};
}