cloud-utils: split of smaller .guest output

This commit is contained in:
Jörg Thalheim 2020-08-18 09:33:18 +01:00
parent 33ea7ef8fd
commit 4b9a2e13a8
No known key found for this signature in database
GPG Key ID: 003F2096411B5F92
2 changed files with 25 additions and 7 deletions

View File

@ -23,7 +23,7 @@ with lib;
copy_bin_and_libs ${pkgs.utillinux}/sbin/sfdisk
copy_bin_and_libs ${pkgs.utillinux}/sbin/lsblk
substitute "${pkgs.cloud-utils}/bin/.growpart-wrapped" "$out/bin/growpart" \
substitute "${pkgs.cloud-utils.guest}/bin/.growpart-wrapped" "$out/bin/growpart" \
--replace "${pkgs.bash}/bin/sh" "/bin/sh" \
--replace "awk" "gawk" \
--replace "sed" "gnused"

View File

@ -1,9 +1,18 @@
{ stdenv, fetchurl, makeWrapper
, gawk, gnused, utillinux, file
, wget, python3, qemu-utils, euca2ools
, e2fsprogs, cdrkit }:
, e2fsprogs, cdrkit
, gptfdisk }:
stdenv.mkDerivation rec {
let
# according to https://packages.debian.org/sid/cloud-image-utils + https://packages.debian.org/sid/admin/cloud-guest-utils
guestDeps = [
e2fsprogs gptfdisk gawk gnused utillinux
];
binDeps = guestDeps ++ [
wget file qemu-utils cdrkit
];
in stdenv.mkDerivation rec {
# NOTICE: if you bump this, make sure to run
# $ nix-build nixos/release-combined.nix -A nixos.tests.ec2-nixops
# growpart is needed in initrd in nixos/system/boot/grow-partition.nix
@ -17,15 +26,24 @@ stdenv.mkDerivation rec {
buildInputs = [ python3 ];
installFlags = [ "LIBDIR=$(out)/lib" "BINDIR=$(out)/bin" "MANDIR=$(out)/man/man1" "DOCDIR=$(out)/doc" ];
# according to https://packages.ubuntu.com/source/zesty/cloud-utils
binDeps = [
wget e2fsprogs file gnused gawk utillinux qemu-utils euca2ools cdrkit
];
# $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"];
postFixup = ''
moveToOutput bin/ec2metadata $guest
moveToOutput bin/growpart $guest
moveToOutput bin/vcs-run $guest
for i in $out/bin/*; do
wrapProgram $i --prefix PATH : "${stdenv.lib.makeBinPath binDeps}:$out/bin"
done
for i in $guest/bin/*; do
wrapProgram $i --prefix PATH : "${stdenv.lib.makeBinPath guestDeps}:$guest/bin"
ln -s $i $out/bin
done
'';
dontBuild = true;