Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitLab, 5 dpkg, 6 gawk, 7 perl, 8 wget, 9 binutils, 10 bzip2, 11 coreutils, 12 util-linux, 13 gnugrep, 14 gnupg, 15 gnutar, 16 gnused, 17 gzip, 18 xz, 19 zstd, 20 makeWrapper, 21 nix-update-script, 22 testers, 23 debootstrap, 24}: 25 26# USAGE like this: debootstrap sid /tmp/target-chroot-directory 27# There is also cdebootstrap now. Is that easier to maintain? 28let 29 binPath = lib.makeBinPath [ 30 binutils 31 bzip2 32 coreutils 33 dpkg 34 gawk 35 gnugrep 36 gnupg 37 gnused 38 gnutar 39 gzip 40 perl 41 util-linux 42 wget 43 xz 44 zstd 45 ]; 46in 47stdenv.mkDerivation rec { 48 pname = "debootstrap"; 49 version = "1.0.140_bpo12+1"; 50 51 src = fetchFromGitLab { 52 domain = "salsa.debian.org"; 53 owner = "installer-team"; 54 repo = "debootstrap"; 55 rev = "refs/tags/${version}"; 56 hash = "sha256-4vINaMRo6IrZ6e2/DAJ06ODy2BWm4COR1JDSY52upUc="; 57 }; 58 59 nativeBuildInputs = [ makeWrapper ]; 60 61 dontBuild = true; 62 63 installPhase = '' 64 runHook preInstall 65 66 substituteInPlace debootstrap \ 67 --replace 'CHROOT_CMD="chroot ' 'CHROOT_CMD="${coreutils}/bin/chroot ' \ 68 --replace 'CHROOT_CMD="unshare ' 'CHROOT_CMD="${util-linux}/bin/unshare ' \ 69 --replace /usr/bin/dpkg ${dpkg}/bin/dpkg \ 70 --replace '#!/bin/sh' '#!/bin/bash' \ 71 --subst-var-by VERSION ${version} 72 73 d=$out/share/debootstrap 74 mkdir -p $out/{share/debootstrap,bin} 75 76 mv debootstrap $out/bin 77 78 cp -r . $d 79 80 wrapProgram $out/bin/debootstrap \ 81 --set PATH ${binPath} \ 82 --set-default DEBOOTSTRAP_DIR $d 83 84 mkdir -p $out/man/man8 85 mv debootstrap.8 $out/man/man8 86 87 rm -rf $d/debian 88 89 runHook postInstall 90 ''; 91 92 passthru = { 93 updateScript = nix-update-script { }; 94 tests.version = testers.testVersion { 95 package = debootstrap; 96 }; 97 }; 98 99 meta = { 100 changelog = "https://salsa.debian.org/installer-team/debootstrap/-/blob/${version}/debian/changelog"; 101 description = "Tool to create a Debian system in a chroot"; 102 homepage = "https://wiki.debian.org/Debootstrap"; 103 license = lib.licenses.mit; 104 maintainers = with lib.maintainers; [ marcweber ]; 105 platforms = lib.platforms.linux; 106 mainProgram = "debootstrap"; 107 }; 108}