python312Packages.icontract: relax deps (#380554)
[NixPkgs.git] / pkgs / by-name / de / debootstrap / package.nix
blobb784f5980be4dc5753f5c493c6cf74576d01c93c
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   makeWrapper,
20   nix-update-script,
21   testers,
22   debootstrap,
25 # USAGE like this: debootstrap sid /tmp/target-chroot-directory
26 # There is also cdebootstrap now. Is that easier to maintain?
27 let
28   binPath = lib.makeBinPath [
29     binutils
30     bzip2
31     coreutils
32     dpkg
33     gawk
34     gnugrep
35     gnupg
36     gnused
37     gnutar
38     gzip
39     perl
40     util-linux
41     wget
42     xz
43   ];
45 stdenv.mkDerivation rec {
46   pname = "debootstrap";
47   version = "1.0.140_bpo12+1";
49   src = fetchFromGitLab {
50     domain = "salsa.debian.org";
51     owner = "installer-team";
52     repo = "debootstrap";
53     rev = "refs/tags/${version}";
54     hash = "sha256-4vINaMRo6IrZ6e2/DAJ06ODy2BWm4COR1JDSY52upUc=";
55   };
57   nativeBuildInputs = [ makeWrapper ];
59   dontBuild = true;
61   installPhase = ''
62     runHook preInstall
64     substituteInPlace debootstrap \
65       --replace 'CHROOT_CMD="chroot '  'CHROOT_CMD="${coreutils}/bin/chroot ' \
66       --replace 'CHROOT_CMD="unshare ' 'CHROOT_CMD="${util-linux}/bin/unshare ' \
67       --replace /usr/bin/dpkg ${dpkg}/bin/dpkg \
68       --replace '#!/bin/sh' '#!/bin/bash' \
69       --subst-var-by VERSION ${version}
71     d=$out/share/debootstrap
72     mkdir -p $out/{share/debootstrap,bin}
74     mv debootstrap $out/bin
76     cp -r . $d
78     wrapProgram $out/bin/debootstrap \
79       --set PATH ${binPath} \
80       --set-default DEBOOTSTRAP_DIR $d
82     mkdir -p $out/man/man8
83     mv debootstrap.8 $out/man/man8
85     rm -rf $d/debian
87     runHook postInstall
88   '';
90   passthru = {
91     updateScript = nix-update-script { };
92     tests.version = testers.testVersion {
93       package = debootstrap;
94     };
95   };
97   meta = with lib; {
98     changelog = "https://salsa.debian.org/installer-team/debootstrap/-/blob/${version}/debian/changelog";
99     description = "Tool to create a Debian system in a chroot";
100     homepage = "https://wiki.debian.org/Debootstrap";
101     license = licenses.mit;
102     maintainers = with maintainers; [ marcweber ];
103     platforms = platforms.linux;
104     mainProgram = "debootstrap";
105   };