1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2025-01-07 03:58:59 +03:00
mobile-nixos/boot/gui/simulator.nix
2020-03-01 23:27:56 -05:00

47 lines
793 B
Nix

{ stdenv
, lib
, callPackage
, mrbgems
}:
let
loader = callPackage ../script-loader {
mrbgems = mrbgems // {
mruby-lvgui = callPackage ../../overlay/mruby-builder/mrbgems/mruby-lvgui {
withSimulator = true;
};
};
};
in
stdenv.mkDerivation {
pname = "boot-gui-simulator";
version = "0.0.1";
src = lib.cleanSource ./.;
nativeBuildInputs = [
loader.mruby
];
buildPhase = ''
(PS4=" $ "; set -x
mrbc -o gui.mrb \
lib/*.rb main.rb
)
'';
installPhase = ''
(PS4=" $ "; set -x
mkdir -p $out/libexec/
cp -v gui.mrb $out/libexec/gui.mrb
mkdir -p $out/bin
cat > $out/bin/simulator <<EOF
#!/bin/sh
${loader}/bin/loader $out/libexec/gui.mrb "\$@"
EOF
chmod +x $out/bin/simulator
)
'';
}