nixpkgs/pkgs/by-name/cl/cloud-utils/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

80 lines
2.0 KiB
Nix

{ 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 = [
e2fsprogs
gptfdisk
gawk
gnused
util-linux
];
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
pname = "cloud-utils";
version = "0.33";
src = fetchFromGitHub {
owner = "canonical";
repo = "cloud-utils";
rev = "refs/tags/${version}";
hash = "sha256-YqfkmYclPZu6Mc2bFYxtiuH7uvfa3V4YlD0aHuKn1hw=";
};
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
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 : "${lib.makeBinPath binDeps}:$out/bin"
done
for i in $guest/bin/*; do
wrapProgram $i --prefix PATH : "${lib.makeBinPath guestDeps}:$guest/bin"
ln -s $i $out/bin
done
'';
dontBuild = true;
passthru.updateScript = gitUpdater { };
meta = with lib; {
description = "Useful set of utilities for interacting with a cloud";
homepage = "https://github.com/canonical/cloud-utils";
platforms = platforms.unix;
license = licenses.gpl3;
};
}