Merge pull request #123 from hercules-ci/docs-update

Docs about repl and arion.build function
This commit is contained in:
Robert Hensing 2021-06-11 17:02:11 +02:00 committed by GitHub
commit af8257eb66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -205,15 +205,47 @@ $ arion logs -f
You can go to `examples/*/` and run these commands to give it a quick try. You can go to `examples/*/` and run these commands to give it a quick try.
== A full featured Nix command example === Inspect the config
To see how Arion can be used in a project, have a look at While developing an arion project, you can make use of `arion repl`, which launches
https://github.com/nix-community/todomvc-nix/tree/master/deploy/arion[todomvc-nix]. a `nix repl` on the project configuration.
```bash ```
$ git clone https://github.com/nix-community/todomvc-nix $ arion repl
$ cd todomvc-nix/deploy/arion Launching a repl for you. To get started:
$ arion up
To see deployment-wide configuration
type config. and use tab completion
To bring the top-level Nixpkgs attributes into scope
type :a (config._module.args.pkgs) // { inherit config; }
Welcome to Nix. Type :? for help.
Loading '../../src/nix/eval-composition.nix'...
Added 5 variables.
nix-repl> config.services.webserver.service.command
[ "sh" "-c" "cd \"$$WEB_ROOT\"\n/nix/store/66fbv9mmx1j4hrn9y06kcp73c3yb196r-python3-3.8.9/bin/python -m http.server\n" ]
nix-repl>
```
== Build with Nix
You can build a project with `nix-build` using an expression like
```nix
arion.build { modules = [ ./arion-compose.nix ]; pkgs = import ./arion-pkgs.nix; }
```
If you deploy with xref:hercules-ci-effects:ROOT:reference/nix-functions/runArion.adoc[integrate],
and your `pkgs` variable is equivalent to `import ./arion-pkgs.nix`, you can use:
```nix
let
deployment = pkgs.effects.runArion { /* ... */ });
in deployment.prebuilt
``` ```
== Project Status == Project Status