diff options
Diffstat (limited to 'Urbit/Ship.nix')
-rw-r--r-- | Urbit/Ship.nix | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Urbit/Ship.nix b/Urbit/Ship.nix new file mode 100644 index 0000000..ec6a9ec --- /dev/null +++ b/Urbit/Ship.nix @@ -0,0 +1,44 @@ +{ bild ? import ../Biz/Bild.nix {} +}: + +# This represents a single ship running in a container. + +let + # bootstrap & startup process, expects two files: + # - /ship.name: containing a ship name like 'sampel-palnet' + # - /ship.key: containing the key + urbit-start = bild.pkgs.writeScript "urbit-start" '' + #!${bild.pkgs.runtimeShell} + set -xeuo pipefail + + ship=$(cat /ship.name) + pier="/$ship" + + if [ -d "$pier" ]; then + # pack pier if it exists, to save space + /bin/urbit-worker pack "$pier" + else + # otherwise, setup + /bin/urbit -c "$pier" -k /ship.key -x + fi + + /bin/urbit -tq "$pier" + ''; +in bild.image { + name = "urbit-ship"; + tag = "latest"; + + fromImage = null; # scratch + + contents = bild.pkgs.urbit; + + config = { + Cmd = [ + "${urbit-start}" + ]; + WorkingDir = "/"; + Volumes = { + "/" = { }; + }; + }; +} |