aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/tools/misc/debootstrap/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/tools/misc/debootstrap/default.nix')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/tools/misc/debootstrap/default.nix67
1 files changed, 67 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/tools/misc/debootstrap/default.nix b/infra/libkookie/nixpkgs/pkgs/tools/misc/debootstrap/default.nix
new file mode 100644
index 000000000000..4d4afb0b995f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/tools/misc/debootstrap/default.nix
@@ -0,0 +1,67 @@
+{ stdenv, fetchurl, dpkg, gawk, perl, wget, coreutils, util-linux
+, gnugrep, gnutar, gnused, gzip, makeWrapper }:
+# USAGE like this: debootstrap sid /tmp/target-chroot-directory
+# There is also cdebootstrap now. Is that easier to maintain?
+let binPath = stdenv.lib.makeBinPath [
+ coreutils
+ dpkg
+ gawk
+ gnugrep
+ gnused
+ gnutar
+ gzip
+ perl
+ wget
+ ];
+in stdenv.mkDerivation rec {
+ pname = "debootstrap";
+ version = "1.0.123";
+
+ src = fetchurl {
+ # git clone git://git.debian.org/d-i/debootstrap.git
+ # I'd like to use the source. However it's lacking the lanny script ? (still true?)
+ url = "mirror://debian/pool/main/d/${pname}/${pname}_${version}.tar.gz";
+ sha256 = "0a53dhfwa74vdhqd6kbl7zlm7iic37c6wkdclppf0syxxi3q2njy";
+ };
+
+ nativeBuildInputs = [ makeWrapper ];
+
+ dontBuild = true;
+
+ installPhase = ''
+ runHook preInstall
+
+ substituteInPlace debootstrap \
+ --replace 'CHROOT_CMD="chroot ' 'CHROOT_CMD="${coreutils}/bin/chroot ' \
+ --replace 'CHROOT_CMD="unshare ' 'CHROOT_CMD="${util-linux}/bin/unshare ' \
+ --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
+ '';
+
+ meta = with stdenv.lib; {
+ 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;
+ };
+}