From 387665f6161c281613ab697f68af887346f655c4 Mon Sep 17 00:00:00 2001 From: Thiago Franco de Moraes Date: Mon, 12 Apr 2021 17:32:30 -0300 Subject: [PATCH] Ignite: init at 0.9.0 --- .../virtualization/ignite/default.nix | 72 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 74 insertions(+) create mode 100644 pkgs/applications/virtualization/ignite/default.nix diff --git a/pkgs/applications/virtualization/ignite/default.nix b/pkgs/applications/virtualization/ignite/default.nix new file mode 100644 index 00000000000..5439ad57b1a --- /dev/null +++ b/pkgs/applications/virtualization/ignite/default.nix @@ -0,0 +1,72 @@ +{ lib +, cni-plugins +, buildGoModule +, firecracker +, containerd +, runc +, makeWrapper +, fetchFromGitHub +, git +}: + +buildGoModule rec{ + pname = "ignite"; + version = "0.9.0"; + + src = fetchFromGitHub { + owner = "weaveworks"; + repo = "ignite"; + rev = "v${version}"; + sha256 = "sha256-rjCsZ12DHcSw5GZu6jGTtqCPOZDSbYoMplkqvspbvO8="; + leaveDotGit = true; + }; + + vendorSha256 = null; + + doCheck = false; + + postPatch = '' + # ignite tries to run cni-plugins programs from /opt/cni/bin + substituteInPlace pkg/constants/dependencies.go \ + --replace "/opt/cni/bin/loopback" ${cni-plugins}/bin/loopback \ + --replace "/opt/cni/bin/bridge" ${cni-plugins}/bin/bridge + + # ignite tries to run cni-plugins programs from /opt/cni/bin + substituteInPlace pkg/network/cni/cni.go \ + --replace "/opt/cni/bin" ${cni-plugins}/bin + + # fetchgit doesn't fetch tags from git repository so it's necessary to force IGNITE_GIT_VERSION to be ${version} + # also forcing git state to be clean because if it's dirty ignite will try to fetch the image weaveworks/ignite:dev + # which is not in docker.io, we want it to fetch the image weaveworks/ignite:v${version} + substituteInPlace hack/ldflags.sh \ + --replace '$(git describe --tags --abbrev=14 "''${IGNITE_GIT_COMMIT}^{commit}" 2>/dev/null)' "v${version}" \ + --replace 'IGNITE_GIT_TREE_STATE="dirty"' 'IGNITE_GIT_TREE_STATE="clean"' + ''; + + nativeBuildInputs = [ + git + makeWrapper + ]; + + buildInputs = [ + firecracker + ]; + + preBuild = '' + patchShebangs ./hack/ldflags.sh + export buildFlagsArray+=("-ldflags=$(./hack/ldflags.sh)") + ''; + + postInstall = '' + for prog in hack ignite ignited ignite-spawn; do + wrapProgram "$out/bin/$prog" --prefix PATH : ${lib.makeBinPath [ cni-plugins firecracker containerd runc ]} + done + ''; + + meta = with lib; { + description = "Ignite a Firecracker microVM"; + homepage = "https://github.com/weaveworks/ignite"; + license = licenses.asl20; + maintainers = with maintainers; [ tfmoraes ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f8f781f0e10..de54881ab47 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5561,6 +5561,8 @@ in irods irods-icommands; + ignite = callPackage ../applications/virtualization/ignite { }; + igmpproxy = callPackage ../tools/networking/igmpproxy { }; ihaskell = callPackage ../development/tools/haskell/ihaskell/wrapper.nix {