2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchurl, makeWrapper
|
2020-11-24 16:29:28 +01:00
|
|
|
, gawk, gnused, util-linux, file
|
2021-03-02 16:54:02 +01:00
|
|
|
, wget, python3, qemu-utils
|
2020-08-18 10:33:18 +02:00
|
|
|
, e2fsprogs, cdrkit
|
|
|
|
, gptfdisk }:
|
2016-03-30 15:39:53 +02:00
|
|
|
|
2020-08-18 10:33:18 +02:00
|
|
|
let
|
|
|
|
# according to https://packages.debian.org/sid/cloud-image-utils + https://packages.debian.org/sid/admin/cloud-guest-utils
|
|
|
|
guestDeps = [
|
2020-11-24 16:29:28 +01:00
|
|
|
e2fsprogs gptfdisk gawk gnused util-linux
|
2020-08-18 10:33:18 +02:00
|
|
|
];
|
|
|
|
binDeps = guestDeps ++ [
|
|
|
|
wget file qemu-utils cdrkit
|
|
|
|
];
|
|
|
|
in stdenv.mkDerivation rec {
|
2016-11-17 15:14:52 +01:00
|
|
|
# NOTICE: if you bump this, make sure to run
|
|
|
|
# $ nix-build nixos/release-combined.nix -A nixos.tests.ec2-nixops
|
2018-01-06 14:52:51 +01:00
|
|
|
# growpart is needed in initrd in nixos/system/boot/grow-partition.nix
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "cloud-utils";
|
2020-11-01 17:31:51 +01:00
|
|
|
version = "0.32";
|
2016-03-30 15:39:53 +02:00
|
|
|
src = fetchurl {
|
2020-06-29 14:50:15 +02:00
|
|
|
url = "https://launchpad.net/cloud-utils/trunk/${version}/+download/cloud-utils-${version}.tar.gz";
|
2020-11-01 17:31:51 +01:00
|
|
|
sha256 = "0xxdi55lzw7j91zfajw7jhd2ilsqj2dy04i9brlk8j3pvb5ma8hk";
|
2016-03-30 15:39:53 +02:00
|
|
|
};
|
2017-10-01 23:48:20 +02:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ python3 ];
|
|
|
|
installFlags = [ "LIBDIR=$(out)/lib" "BINDIR=$(out)/bin" "MANDIR=$(out)/man/man1" "DOCDIR=$(out)/doc" ];
|
|
|
|
|
2020-08-18 10:33:18 +02:00
|
|
|
# $guest output contains all executables needed for cloud-init and $out the rest + $guest
|
|
|
|
# This is similar to debian's package split into cloud-image-utils and cloud-guest-utils
|
|
|
|
# The reason is to reduce the closure size
|
|
|
|
outputs = [ "out" "guest"];
|
2017-10-01 23:48:20 +02:00
|
|
|
|
|
|
|
postFixup = ''
|
2020-08-18 10:33:18 +02:00
|
|
|
moveToOutput bin/ec2metadata $guest
|
|
|
|
moveToOutput bin/growpart $guest
|
|
|
|
moveToOutput bin/vcs-run $guest
|
|
|
|
|
2017-10-01 23:48:20 +02:00
|
|
|
for i in $out/bin/*; do
|
2021-01-15 10:19:50 +01:00
|
|
|
wrapProgram $i --prefix PATH : "${lib.makeBinPath binDeps}:$out/bin"
|
2017-10-01 23:48:20 +02:00
|
|
|
done
|
2020-08-18 10:33:18 +02:00
|
|
|
|
|
|
|
for i in $guest/bin/*; do
|
2021-01-15 10:19:50 +01:00
|
|
|
wrapProgram $i --prefix PATH : "${lib.makeBinPath guestDeps}:$guest/bin"
|
2020-08-18 10:33:18 +02:00
|
|
|
ln -s $i $out/bin
|
|
|
|
done
|
2016-03-30 15:39:53 +02:00
|
|
|
'';
|
2016-08-02 18:06:29 +02:00
|
|
|
|
2017-10-01 23:48:20 +02:00
|
|
|
dontBuild = true;
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2018-09-11 23:31:27 +02:00
|
|
|
platforms = platforms.unix;
|
|
|
|
license = licenses.gpl3;
|
|
|
|
};
|
2016-03-30 15:39:53 +02:00
|
|
|
}
|