mirror of
https://github.com/ilyakooo0/nix-bundle.git
synced 2024-09-11 15:05:32 +03:00
23 lines
639 B
Nix
23 lines
639 B
Nix
{ stdenv, fetchFromGitHub, patchelf }:
|
|
|
|
stdenv.mkDerivation {
|
|
name = "nix-user-chroot";
|
|
phases = [ "buildPhase" "fixupPhase" "installPhase" ];
|
|
|
|
buildPhase = ''
|
|
cp ${./nix-user-chroot.c} nix-user-chroot.c
|
|
$CC nix-user-chroot.c -o nix-user-chroot
|
|
'';
|
|
|
|
# setup local libc interpreter
|
|
fixupPhase = ''
|
|
patchelf --set-interpreter .$(patchelf --print-interpreter nix-user-chroot) nix-user-chroot
|
|
patchelf --set-rpath $(patchelf --print-rpath nix-user-chroot | sed 's|/nix/store/|./nix/store/|g') nix-user-chroot
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin/
|
|
cp nix-user-chroot $out/bin/nix-user-chroot
|
|
'';
|
|
}
|