forked from hacc/haccfiles
51 lines
2.5 KiB
Org Mode
51 lines
2.5 KiB
Org Mode
|
#+TITLE: Pluto standalone
|
||
|
|
||
|
This is a nix derivation that wraps a version of julia with the packages
|
||
|
(and their dependency closure) defined in ~Packages.toml~; currently
|
||
|
this is just Pluto. It also provides a little julia script that will
|
||
|
activate this packageset (called a "julia depot"), and then start a
|
||
|
Pluto notebook server on port 9999. Note that it does so without setting
|
||
|
up any kind of authenticaton, so don't expose that port!
|
||
|
|
||
|
* TODOs
|
||
|
- [ ] add more packages
|
||
|
- [ ] more sensible auth
|
||
|
- [ ] working precompilation; this would probably allow running this
|
||
|
without a writable julia depot
|
||
|
|
||
|
* Steps to reproduce / update the julia-to-nix part of this:
|
||
|
|
||
|
In general, it is enough to follow the readme of julia2nix, but since
|
||
|
that has a bunch of unstated assumptions and weird failure modes, here's a rough outline of how to actually do it:
|
||
|
- using julia's package managing mode, make changes to ~Packages.toml~
|
||
|
and ~Manifest.toml~. Be sure to use the same version of julia that
|
||
|
will run on hainich (currently the ~julia_15~ package of
|
||
|
nixpkgs-unstable), as otherwise hashes may be different
|
||
|
- clone https://github.com/thomasjm/julia2nix somewhere
|
||
|
- run ~julia2nix~ to generate the nix derivations
|
||
|
+ unfortunately, jula2nix assumes that nixpkgs-unstable is available
|
||
|
as ~<nixpkgs>~ from within nix; it may fail if you are on another
|
||
|
channel. In that case, there seems to be no better solution than grepping for occurences of "<nixpkgs>" in jula2nix and replacing
|
||
|
them with some other path that has the required version
|
||
|
+ this will re-generate all the ~*.nix~ files in this directory, and
|
||
|
probably reset all options. The defaults are reasonably sensible,
|
||
|
but make sure to disable the ~precompile~ option in ~default.nix~
|
||
|
(see below for why)
|
||
|
- run ~nix-build --no-out-link~ to check if it worked and nix can
|
||
|
build the julia depot
|
||
|
- deploy hainich. Note that the derivation will only contain the
|
||
|
package sources, not a compiled version. Julia will compile packages
|
||
|
on startup (and cache them for subsequent runs), so after the deploy
|
||
|
it may take a minute or two to actually run Pluto
|
||
|
|
||
|
* precompilation
|
||
|
/In theory/, we should be able to precompile all the packages during
|
||
|
nix-build, and then directly load them into julia and runtime.
|
||
|
However, this currently fails, and even if precompiled packages are
|
||
|
present in the depot built via nix, julia will refuse to use them and
|
||
|
recompile them instead (in a second julia depot that is writable at
|
||
|
runtime).
|
||
|
|
||
|
There's an open issue on this at jula2nix:
|
||
|
https://github.com/thomasjm/julia2nix/issues/22
|