1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-19 05:51:52 +03:00
mobile-nixos/boot/init/default.nix

61 lines
1.1 KiB
Nix
Raw Normal View History

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