1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-17 13:10:29 +03:00
mobile-nixos/boot/init/default.nix
2020-02-03 16:19:10 -05:00

55 lines
1.1 KiB
Nix

{ fetchurl, mruby, mrbgems }:
let
ruby_rev = "37457117c941b700b150d76879318c429599d83f";
shellwords = fetchurl {
name = "shellwords.rb";
url = "https://raw.githubusercontent.com/ruby/ruby/${ruby_rev}/lib/shellwords.rb";
sha256 = "197g7qvrrijmajixa2h9c4jw26l36y8ig6qjb5d43qg4qykhqfcx";
};
in
mruby.builder {
pname = "mobile-nixos-init";
version = "0.0-unstable";
src = ./.;
postPatch = ''
cp ${shellwords} lib/0001_shellwords.rb
'';
# Sorting ensures a stable lexicographic import order.
# Otherwise the compiler could accidentally be flaky.
buildPhase = ''
get_tasks() {
for s in $tasks; do
find $s -type f -iname '*.rb'
done | sort
}
makeBin init \
$(find lib -type f | sort) \
$(find tasks -type f | sort) \
main.rb
'';
# TODO: better way to handle this?
tasks = [
"./tasks"
];
gems = with mrbgems; [
{ core = "mruby-exit"; }
{ core = "mruby-io"; }
{ core = "mruby-sleep"; }
mruby-dir
mruby-dir-glob
mruby-env
mruby-json
mruby-logger
mruby-open3
mruby-regexp-pcre
mruby-singleton
];
}