1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/build-support/build-fhs-userenv/chrootenv/default.nix
Yegor Timoshenko 4b1cf5afb8
chrootenv: rewrite on top of GLib
Changes:

* doesn't handle root user separately
* doesn't chdir("/") which makes using it seamless
* only bind mounts, doesn't symlink (i.e. files)

Incidentally, fixes #33106.

It's about two times shorter than the previous version, and much
easier to read/follow through. It uses GLib quite heavily, along with
RAII (available in GCC/Clang).
2017-12-30 22:28:38 +00:00

20 lines
457 B
Nix

{ stdenv, pkgconfig, glib }:
stdenv.mkDerivation {
name = "chrootenv";
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ glib ];
buildCommand = ''
cc ${./chrootenv.c} $(pkg-config --cflags --libs glib-2.0) -o $out
'';
meta = with stdenv.lib; {
description = "Setup mount/user namespace for FHS emulation";
license = licenses.free;
maintainers = with maintainers; [ yegortimoshenko ];
platforms = platforms.linux;
};
}