2023-10-09 19:29:22 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitLab
|
|
|
|
, dpkg
|
|
|
|
, gawk
|
|
|
|
, perl
|
|
|
|
, wget
|
|
|
|
, binutils
|
|
|
|
, bzip2
|
|
|
|
, coreutils
|
|
|
|
, util-linux
|
|
|
|
, gnugrep
|
|
|
|
, gnupg1
|
|
|
|
, gnutar
|
|
|
|
, gnused
|
|
|
|
, gzip
|
|
|
|
, xz
|
|
|
|
, makeWrapper
|
|
|
|
, nix-update-script
|
|
|
|
, testers
|
|
|
|
, debootstrap
|
|
|
|
}:
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# USAGE like this: debootstrap sid /tmp/target-chroot-directory
|
|
|
|
# There is also cdebootstrap now. Is that easier to maintain?
|
2021-01-15 22:18:51 +00:00
|
|
|
let binPath = lib.makeBinPath [
|
2022-12-28 21:21:41 +00:00
|
|
|
binutils
|
|
|
|
bzip2
|
2020-04-24 23:36:52 +00:00
|
|
|
coreutils
|
|
|
|
dpkg
|
|
|
|
gawk
|
|
|
|
gnugrep
|
2021-10-28 06:52:43 +00:00
|
|
|
gnupg1
|
2020-04-24 23:36:52 +00:00
|
|
|
gnused
|
|
|
|
gnutar
|
|
|
|
gzip
|
|
|
|
perl
|
|
|
|
wget
|
2022-12-28 21:21:41 +00:00
|
|
|
xz
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "debootstrap";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "1.0.131";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
src = fetchFromGitLab {
|
|
|
|
domain = "salsa.debian.org";
|
|
|
|
owner = "installer-team";
|
|
|
|
repo = pname;
|
2023-10-09 19:29:22 +00:00
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-rwNcrS2GzVs0JYxeHcpLMG9FDwSpthNmZIemn95hC6g=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
substituteInPlace debootstrap \
|
|
|
|
--replace 'CHROOT_CMD="chroot ' 'CHROOT_CMD="${coreutils}/bin/chroot ' \
|
2020-11-24 20:58:05 +00:00
|
|
|
--replace 'CHROOT_CMD="unshare ' 'CHROOT_CMD="${util-linux}/bin/unshare ' \
|
2020-04-24 23:36:52 +00:00
|
|
|
--replace /usr/bin/dpkg ${dpkg}/bin/dpkg \
|
|
|
|
--replace '#!/bin/sh' '#!/bin/bash' \
|
|
|
|
--subst-var-by VERSION ${version}
|
|
|
|
|
|
|
|
d=$out/share/debootstrap
|
|
|
|
mkdir -p $out/{share/debootstrap,bin}
|
|
|
|
|
|
|
|
mv debootstrap $out/bin
|
|
|
|
|
|
|
|
cp -r . $d
|
|
|
|
|
|
|
|
wrapProgram $out/bin/debootstrap \
|
|
|
|
--set PATH ${binPath} \
|
|
|
|
--set-default DEBOOTSTRAP_DIR $d
|
|
|
|
|
|
|
|
mkdir -p $out/man/man8
|
|
|
|
mv debootstrap.8 $out/man/man8
|
|
|
|
|
|
|
|
rm -rf $d/debian
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
tests.version = testers.testVersion {
|
|
|
|
package = debootstrap;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2023-10-09 19:29:22 +00:00
|
|
|
changelog = "https://salsa.debian.org/installer-team/debootstrap/-/blob/${version}/debian/changelog";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Tool to create a Debian system in a chroot";
|
|
|
|
homepage = "https://wiki.debian.org/Debootstrap";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ marcweber ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|