2018-06-13 05:28:33 +03:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -p ruby -i ruby
|
|
|
|
|
2018-06-23 23:12:39 +03:00
|
|
|
require_relative "../lib/rb/all.rb"
|
2018-06-23 23:06:53 +03:00
|
|
|
|
2018-06-13 05:28:33 +03:00
|
|
|
# Given a device name, instantiates `nix-build` to build
|
|
|
|
# everything needed to boot on that device.
|
|
|
|
|
2018-06-17 02:21:41 +03:00
|
|
|
if ARGV.count < 1 then
|
2018-06-13 05:29:26 +03:00
|
|
|
puts "Usage: bin/build <device-name>"
|
2018-06-13 05:28:33 +03:00
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
|
|
|
|
DEVICE = ARGV.shift
|
2019-04-14 07:49:30 +03:00
|
|
|
NIXPKGS=File.join(*__dir__.split("/")[0..-2], "nixpkgs")
|
2018-06-13 05:28:33 +03:00
|
|
|
|
2018-06-23 23:06:53 +03:00
|
|
|
run(
|
2018-11-06 04:50:47 +03:00
|
|
|
"env", "-i",
|
2018-06-17 02:21:41 +03:00
|
|
|
"nix-build", "-A", "all",
|
2019-04-14 07:49:30 +03:00
|
|
|
"-I", "nixpkgs=#{NIXPKGS}",
|
2018-06-17 02:21:41 +03:00
|
|
|
"--argstr", "device", DEVICE,
|
2018-06-24 05:08:24 +03:00
|
|
|
*ARGV,
|
|
|
|
exec: true
|
2018-06-23 23:06:53 +03:00
|
|
|
)
|
2018-06-13 05:28:33 +03:00
|
|
|
|
|
|
|
# vim: ft=ruby
|