nixpkgs/pkgs/applications/virtualization/krunvm/default.nix

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

75 lines
1.8 KiB
Nix
Raw Normal View History

2022-08-13 09:43:27 +00:00
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, asciidoctor
2022-08-16 16:46:17 +00:00
, buildah
, buildah-unwrapped
, cargo
2022-08-16 16:46:17 +00:00
, libiconv
2022-08-13 09:43:27 +00:00
, libkrun
2022-08-16 16:46:17 +00:00
, makeWrapper
, rustc
2022-08-16 16:46:17 +00:00
, sigtool
2022-08-13 09:43:27 +00:00
}:
stdenv.mkDerivation rec {
pname = "krunvm";
2022-11-30 12:28:02 +00:00
version = "0.2.3";
2022-08-13 09:43:27 +00:00
src = fetchFromGitHub {
owner = "containers";
repo = pname;
rev = "v${version}";
2022-11-30 12:28:02 +00:00
hash = "sha256-IXofYsOmbrjq8Zq9+a6pvBYsvZFcKzN5IvCuHaxwazI=";
2022-08-13 09:43:27 +00:00
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
2022-11-30 12:28:02 +00:00
hash = "sha256-Y0FNi/+HuN5SqexHTKjcW6lEaeis7xZDYc2/FOAANIA=";
2022-08-13 09:43:27 +00:00
};
nativeBuildInputs = [
rustPlatform.cargoSetupHook
cargo
rustc
2022-08-13 09:43:27 +00:00
asciidoctor
2022-08-16 16:46:17 +00:00
makeWrapper
] ++ lib.optionals stdenv.isDarwin [ sigtool ];
2022-08-13 09:43:27 +00:00
2022-08-16 16:46:17 +00:00
buildInputs = [ libkrun ] ++ lib.optionals stdenv.isDarwin [
libiconv
];
2022-08-13 09:43:27 +00:00
makeFlags = [ "PREFIX=${placeholder "out"}" ];
2022-08-16 16:46:17 +00:00
postPatch = ''
# do not pollute etc
substituteInPlace src/utils.rs \
--replace "etc/containers" "share/krunvm/containers"
'';
postInstall = ''
mkdir -p $out/share/krunvm/containers
install -D -m755 ${buildah-unwrapped.src}/docs/samples/registries.conf $out/share/krunvm/containers/registries.conf
install -D -m755 ${buildah-unwrapped.src}/tests/policy.json $out/share/krunvm/containers/policy.json
'';
# It attaches entitlements with codesign and strip removes those,
# voiding the entitlements and making it non-operational.
dontStrip = stdenv.isDarwin;
postFixup = ''
wrapProgram $out/bin/krunvm \
--prefix PATH : ${lib.makeBinPath [ buildah ]} \
'';
2022-08-13 09:43:27 +00:00
meta = with lib; {
description = "A CLI-based utility for creating microVMs from OCI images";
homepage = "https://github.com/containers/krunvm";
license = licenses.asl20;
maintainers = with maintainers; [ nickcao ];
2023-01-26 07:03:36 +00:00
platforms = libkrun.meta.platforms;
2022-08-13 09:43:27 +00:00
};
}