nixpkgs/pkgs/tools/misc/debootstrap/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

103 lines
2.1 KiB
Nix
Raw Normal View History

2023-08-24 21:31:02 +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
}:
# USAGE like this: debootstrap sid /tmp/target-chroot-directory
# There is also cdebootstrap now. Is that easier to maintain?
2021-01-15 09:19:50 +00:00
let binPath = lib.makeBinPath [
2022-12-26 08:03:08 +00:00
binutils
bzip2
coreutils
dpkg
gawk
gnugrep
2021-10-20 19:07:26 +00:00
gnupg1
gnused
gnutar
gzip
perl
wget
xz
];
in stdenv.mkDerivation rec {
2019-07-12 17:12:14 +00:00
pname = "debootstrap";
2024-08-05 09:43:48 +00:00
version = "1.0.137";
2022-03-31 01:52:52 +00:00
src = fetchFromGitLab {
domain = "salsa.debian.org";
owner = "installer-team";
2024-08-05 09:43:48 +00:00
repo = "debootstrap";
2023-08-24 21:31:02 +00:00
rev = "refs/tags/${version}";
2024-08-05 09:43:48 +00:00
hash = "sha256-l4vdojsrHAJsa8RwZezH3uI6pWJHK/PBs+YZCtnpXnQ=";
};
nativeBuildInputs = [ makeWrapper ];
dontBuild = true;
installPhase = ''
runHook preInstall
substituteInPlace debootstrap \
--replace 'CHROOT_CMD="chroot ' 'CHROOT_CMD="${coreutils}/bin/chroot ' \
2020-11-24 15:29:28 +00:00
--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
'';
2023-08-24 21:31:02 +00:00
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion {
package = debootstrap;
};
};
meta = with lib; {
2023-08-24 21:31:02 +00:00
changelog = "https://salsa.debian.org/installer-team/debootstrap/-/blob/${version}/debian/changelog";
description = "Tool to create a Debian system in a chroot";
2020-03-04 19:34:32 +00:00
homepage = "https://wiki.debian.org/Debootstrap";
2019-07-12 17:12:14 +00:00
license = licenses.mit;
maintainers = with maintainers; [ marcweber ];
platforms = platforms.linux;
2023-11-27 01:17:53 +00:00
mainProgram = "debootstrap";
};
}