chrootenv: use meson

This commit is contained in:
Yegor Timoshenko 2018-11-04 11:33:34 +00:00
parent ccb76eeb3c
commit cea0e9226f
No known key found for this signature in database
GPG key ID: B0B0D739BB47A03A
3 changed files with 11 additions and 10 deletions

View file

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

View file

@ -0,0 +1,5 @@
project('chrootenv', 'c')
glib = dependency('glib-2.0')
executable('chrootenv', 'chrootenv.c', dependencies: [glib], install: true)

View file

@ -28,7 +28,7 @@ in runCommand name {
passthru = passthru // {
env = runCommand "${name}-shell-env" {
shellHook = ''
exec ${chrootenv} ${init runScript} "$(pwd)"
exec ${chrootenv}/bin/chrootenv ${init runScript} "$(pwd)"
'';
} ''
echo >&2 ""
@ -41,7 +41,7 @@ in runCommand name {
mkdir -p $out/bin
cat <<EOF >$out/bin/${name}
#! ${stdenv.shell}
exec ${chrootenv} ${init runScript} "\$(pwd)" "\$@"
exec ${chrootenv}/bin/chrootenv ${init runScript} "\$(pwd)" "\$@"
EOF
chmod +x $out/bin/${name}
${extraInstallCommands}