nixpkgs/pkgs/by-name/cl/cloud-utils/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

80 lines
2.0 KiB
Nix
Raw Normal View History

2024-09-21 05:00:02 +00:00
{ lib
, stdenv
, fetchFromGitHub
, gitUpdater
, makeWrapper
, gawk
, gnused
, util-linux
, file
, wget
, python3
, qemu-utils
, e2fsprogs
, cdrkit
, gptfdisk
}:
let
# according to https://packages.debian.org/sid/cloud-image-utils + https://packages.debian.org/sid/admin/cloud-guest-utils
guestDeps = [
2024-09-21 05:00:02 +00:00
e2fsprogs
gptfdisk
gawk
gnused
util-linux
];
binDeps = guestDeps ++ [
2024-09-21 05:00:02 +00:00
wget
file
qemu-utils
cdrkit
];
2024-09-21 05:00:02 +00:00
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
pname = "cloud-utils";
2024-09-21 05:00:02 +00:00
version = "0.33";
src = fetchFromGitHub {
owner = "canonical";
repo = "cloud-utils";
rev = "refs/tags/${version}";
hash = "sha256-YqfkmYclPZu6Mc2bFYxtiuH7uvfa3V4YlD0aHuKn1hw=";
};
2017-10-01 21:48:20 +00:00
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ python3 ];
installFlags = [ "LIBDIR=$(out)/lib" "BINDIR=$(out)/bin" "MANDIR=$(out)/man/man1" "DOCDIR=$(out)/doc" ];
# $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
2024-09-21 05:00:02 +00:00
outputs = [ "out" "guest" ];
2017-10-01 21:48:20 +00:00
postFixup = ''
moveToOutput bin/ec2metadata $guest
moveToOutput bin/growpart $guest
moveToOutput bin/vcs-run $guest
2017-10-01 21:48:20 +00:00
for i in $out/bin/*; do
2021-01-15 09:19:50 +00:00
wrapProgram $i --prefix PATH : "${lib.makeBinPath binDeps}:$out/bin"
2017-10-01 21:48:20 +00:00
done
for i in $guest/bin/*; do
2021-01-15 09:19:50 +00:00
wrapProgram $i --prefix PATH : "${lib.makeBinPath guestDeps}:$guest/bin"
ln -s $i $out/bin
done
'';
2017-10-01 21:48:20 +00:00
dontBuild = true;
2024-09-21 05:00:02 +00:00
passthru.updateScript = gitUpdater { };
meta = with lib; {
2024-09-21 05:00:02 +00:00
description = "Useful set of utilities for interacting with a cloud";
homepage = "https://github.com/canonical/cloud-utils";
2018-09-11 21:31:27 +00:00
platforms = platforms.unix;
license = licenses.gpl3;
};
}