2021-06-28 23:13:55 +00:00
|
|
|
{ lib
|
|
|
|
, pkg-config
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, coreutils
|
|
|
|
, gnupg
|
|
|
|
, gnutar
|
|
|
|
, squashfsTools
|
|
|
|
, debootstrap
|
2023-04-12 12:48:02 +00:00
|
|
|
, fetchpatch
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
let
|
|
|
|
bins = [
|
|
|
|
coreutils
|
|
|
|
gnupg
|
|
|
|
gnutar
|
|
|
|
squashfsTools
|
|
|
|
debootstrap
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
2021-06-28 23:13:55 +00:00
|
|
|
buildGoModule rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "distrobuilder";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "2.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
vendorSha256 = "sha256-yRMsf8KfpNmVUX4Rn4ZPLUPFZCT/g78MKAfgbFDPVkE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lxc";
|
|
|
|
repo = "distrobuilder";
|
2021-06-28 23:13:55 +00:00
|
|
|
rev = "distrobuilder-${version}";
|
2022-08-12 12:06:08 +00:00
|
|
|
sha256 = "sha256-t3ECLtb0tvIzTWgjmVQDFza+kcm3abTZZMSGYjvw1qQ=";
|
2021-06-28 23:13:55 +00:00
|
|
|
fetchSubmodules = false;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
buildInputs = bins;
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
patches = [
|
|
|
|
# go.mod update: needed to to include a newer lxd which contains
|
2023-08-04 22:07:22 +00:00
|
|
|
# https://github.com/canonical/lxd/commit/d83f061a21f509d42b7a334b97403d2a019a7b52
|
2023-04-12 12:48:02 +00:00
|
|
|
# which is needed to fix the build w/glibc-2.36.
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/lxc/distrobuilder/commit/5346bcc77dd7f141a36a8da851f016d0b929835e.patch";
|
|
|
|
sha256 = "sha256-H6cSbY0v/FThx72AvoAvUCs2VCYN/PQ0W4H82mQQ3SI=";
|
|
|
|
})
|
|
|
|
# Fixup to keep it building after go.mod update.
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/lxc/distrobuilder/commit/2c8cbfbf603e7446efce9f30812812336ccf4f2c.patch";
|
|
|
|
sha256 = "sha256-qqofghcHGosR2qycGb02c8rwErFyRRhsRKdQfyah8Ds=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
# tests require a local keyserver (mkg20001/nixpkgs branch distrobuilder-with-tests) but gpg is currently broken in tests
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
makeWrapper
|
|
|
|
] ++ bins;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
2021-06-28 23:13:55 +00:00
|
|
|
wrapProgram $out/bin/distrobuilder --prefix PATH ":" ${lib.makeBinPath bins}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "System container image builder for LXC and LXD";
|
|
|
|
homepage = "https://github.com/lxc/distrobuilder";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ megheaiulian ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|