diff --git a/pkgs/build-support/build-fhs-userenv/chrootenv/default.nix b/pkgs/build-support/build-fhs-userenv/chrootenv/default.nix index 4ab8c248e2fa..70a7a43bd398 100644 --- a/pkgs/build-support/build-fhs-userenv/chrootenv/default.nix +++ b/pkgs/build-support/build-fhs-userenv/chrootenv/default.nix @@ -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; }; diff --git a/pkgs/build-support/build-fhs-userenv/chrootenv/meson.build b/pkgs/build-support/build-fhs-userenv/chrootenv/meson.build new file mode 100644 index 000000000000..6d0770a0dc4a --- /dev/null +++ b/pkgs/build-support/build-fhs-userenv/chrootenv/meson.build @@ -0,0 +1,5 @@ +project('chrootenv', 'c') + +glib = dependency('glib-2.0') + +executable('chrootenv', 'chrootenv.c', dependencies: [glib], install: true) diff --git a/pkgs/build-support/build-fhs-userenv/default.nix b/pkgs/build-support/build-fhs-userenv/default.nix index 2bad200efc4d..707b256cd4b4 100644 --- a/pkgs/build-support/build-fhs-userenv/default.nix +++ b/pkgs/build-support/build-fhs-userenv/default.nix @@ -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 <$out/bin/${name} #! ${stdenv.shell} - exec ${chrootenv} ${init runScript} "\$(pwd)" "\$@" + exec ${chrootenv}/bin/chrootenv ${init runScript} "\$(pwd)" "\$@" EOF chmod +x $out/bin/${name} ${extraInstallCommands}