docs: Fix examples using asciidoc includes
This commit is contained in:
parent
261d1507d6
commit
295e8698bd
4 changed files with 17 additions and 64 deletions
1
docs/modules/ROOT/examples/full-nixos/arion-compose.nix
Symbolic link
1
docs/modules/ROOT/examples/full-nixos/arion-compose.nix
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../../../../examples/full-nixos/arion-compose.nix
|
1
docs/modules/ROOT/examples/minimal/arion-compose.nix
Symbolic link
1
docs/modules/ROOT/examples/minimal/arion-compose.nix
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../../../../examples/minimal/arion-compose.nix
|
1
docs/modules/ROOT/examples/nixos-unit/arion-compose.nix
Symbolic link
1
docs/modules/ROOT/examples/nixos-unit/arion-compose.nix
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../../../../examples/nixos-unit/arion-compose.nix
|
|
@ -113,75 +113,20 @@ Describe containers using NixOS-style modules. There are a few options:
|
||||||
|
|
||||||
==== Minimal: Plain command using nixpkgs
|
==== Minimal: Plain command using nixpkgs
|
||||||
|
|
||||||
`examples/minimal/arion-compose.nix`:
|
`examples/minimal/arion-compose.nix`
|
||||||
|
[,nix]
|
||||||
```nix
|
----
|
||||||
{ pkgs, ... }:
|
include::example$minimal/arion-compose.nix[]
|
||||||
{
|
----
|
||||||
config.services = {
|
|
||||||
|
|
||||||
webserver = {
|
|
||||||
service.useHostStore = true;
|
|
||||||
service.command = [ "sh" "-c" ''
|
|
||||||
cd "$$WEB_ROOT"
|
|
||||||
${pkgs.python3}/bin/python -m http.server
|
|
||||||
'' ];
|
|
||||||
service.ports = [
|
|
||||||
"8000:8000" # host:container
|
|
||||||
];
|
|
||||||
service.environment.WEB_ROOT = "${pkgs.nix.doc}/share/doc/nix/manual";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
==== NixOS: run only one systemd service
|
|
||||||
|
|
||||||
`examples/nixos-unit/arion-compose.nix`:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
{
|
|
||||||
services.webserver = { config, pkgs, ... }: {
|
|
||||||
|
|
||||||
nixos.configuration = {config, pkgs, ...}: {
|
|
||||||
boot.isContainer = true;
|
|
||||||
services.nginx.enable = true;
|
|
||||||
services.nginx.virtualHosts.localhost.root = "${pkgs.nix.doc}/share/doc/nix/manual";
|
|
||||||
system.build.run-nginx = pkgs.writeScript "run-nginx" ''
|
|
||||||
#!${pkgs.bash}/bin/bash
|
|
||||||
PATH='${config.systemd.services.nginx.environment.PATH}'
|
|
||||||
echo nginx:x:${toString config.users.users.nginx.uid}:${toString config.users.groups.nginx.gid}:nginx web server user:/var/empty:/bin/sh >>/etc/passwd
|
|
||||||
echo nginx:x:${toString config.users.groups.nginx.gid}:nginx >>/etc/group
|
|
||||||
${config.systemd.services.nginx.runner}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
service.command = [ config.nixos.build.run-nginx ];
|
|
||||||
service.useHostStore = true;
|
|
||||||
service.ports = [
|
|
||||||
"8000:80" # host:container
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
==== NixOS: run full OS
|
==== NixOS: run full OS
|
||||||
|
|
||||||
`examples/full-nixos/arion-compose.nix`:
|
`examples/full-nixos/arion-compose.nix`:
|
||||||
|
|
||||||
```nix
|
[,nix]
|
||||||
{
|
----
|
||||||
services.webserver = { pkgs, ... }: {
|
include::example$full-nixos/arion-compose.nix[]
|
||||||
nixos.useSystemd = true;
|
----
|
||||||
nixos.configuration.boot.tmpOnTmpfs = true;
|
|
||||||
nixos.configuration.services.nginx.enable = true;
|
|
||||||
nixos.configuration.services.nginx.virtualHosts.localhost.root = "${pkgs.nix.doc}/share/doc/nix/manual";
|
|
||||||
service.useHostStore = true;
|
|
||||||
service.ports = [
|
|
||||||
"8000:80" # host:container
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
==== Docker image from DockerHub
|
==== Docker image from DockerHub
|
||||||
|
|
||||||
|
@ -195,6 +140,11 @@ Describe containers using NixOS-style modules. There are a few options:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
==== NixOS: run only one systemd service
|
||||||
|
|
||||||
|
Running individual units from NixOS is possible using an experimental script.
|
||||||
|
See `examples/nixos-unit/arion-compose.nix`.
|
||||||
|
|
||||||
=== Run
|
=== Run
|
||||||
|
|
||||||
Start containers and watch their logs:
|
Start containers and watch their logs:
|
||||||
|
|
Loading…
Reference in a new issue