1 { lib, stdenv, fetchFromGitLab, dpkg, gawk, perl, wget, coreutils, util-linux
2 , gnugrep, gnupg1, gnutar, gnused, gzip, makeWrapper }:
3 # USAGE like this: debootstrap sid /tmp/target-chroot-directory
4 # There is also cdebootstrap now. Is that easier to maintain?
5 let binPath = lib.makeBinPath [
17 in stdenv.mkDerivation rec {
18 pname = "debootstrap";
21 src = fetchFromGitLab {
22 domain = "salsa.debian.org";
23 owner = "installer-team";
26 sha256 = "sha256-WybWWyRPreokjUAdWfZ2MUjgZhF1GTncpbLajQ3rh0E=";
29 nativeBuildInputs = [ makeWrapper ];
36 substituteInPlace debootstrap \
37 --replace 'CHROOT_CMD="chroot ' 'CHROOT_CMD="${coreutils}/bin/chroot ' \
38 --replace 'CHROOT_CMD="unshare ' 'CHROOT_CMD="${util-linux}/bin/unshare ' \
39 --replace /usr/bin/dpkg ${dpkg}/bin/dpkg \
40 --replace '#!/bin/sh' '#!/bin/bash' \
41 --subst-var-by VERSION ${version}
43 d=$out/share/debootstrap
44 mkdir -p $out/{share/debootstrap,bin}
46 mv debootstrap $out/bin
50 wrapProgram $out/bin/debootstrap \
51 --set PATH ${binPath} \
52 --set-default DEBOOTSTRAP_DIR $d
54 mkdir -p $out/man/man8
55 mv debootstrap.8 $out/man/man8
63 description = "Tool to create a Debian system in a chroot";
64 homepage = "https://wiki.debian.org/Debootstrap";
65 license = licenses.mit;
66 maintainers = with maintainers; [ marcweber ];
67 platforms = platforms.linux;