From cabcbcacca1ba6e71f91dbccec24880850bdf516 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 16 Dec 2022 02:44:50 +0100 Subject: [PATCH] Duplicate the examples once more, because antora is broken --- docs/modules/ROOT/pages/index.adoc | 39 ++++++++++++++++++++++++++++-- examples/minimal/arion-compose.nix | 4 +-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc index 7b63fe6..9bda09c 100644 --- a/docs/modules/ROOT/pages/index.adoc +++ b/docs/modules/ROOT/pages/index.adoc @@ -116,7 +116,26 @@ Describe containers using NixOS-style modules. There are a few options: `examples/minimal/arion-compose.nix` [,nix] ---- -include::arion:ROOT:example$minimal/arion-compose.nix[] +{ pkgs, ... }: +{ + project.name = "webapp"; + services = { + + webserver = { + image.enableRecommendedContents = true; + 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"; + service.stop_signal = "SIGINT"; + }; + }; +} ---- ==== NixOS: run full OS @@ -125,7 +144,23 @@ include::arion:ROOT:example$minimal/arion-compose.nix[] [,nix] ---- -include::arion:ROOT:example$full-nixos/arion-compose.nix[] +{ + project.name = "full-nixos"; + services.webserver = { pkgs, lib, ... }: { + 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"; + nixos.configuration.services.nscd.enable = false; + nixos.configuration.system.nssModules = lib.mkForce []; + nixos.configuration.systemd.services.nginx.serviceConfig.AmbientCapabilities = + lib.mkForce [ "CAP_NET_BIND_SERVICE" ]; + service.useHostStore = true; + service.ports = [ + "8000:80" # host:container + ]; + }; +} ---- ==== Docker image from DockerHub diff --git a/examples/minimal/arion-compose.nix b/examples/minimal/arion-compose.nix index 54a593a..3dd8075 100644 --- a/examples/minimal/arion-compose.nix +++ b/examples/minimal/arion-compose.nix @@ -1,7 +1,7 @@ { pkgs, ... }: { - config.project.name = "webapp"; - config.services = { + project.name = "webapp"; + services = { webserver = { image.enableRecommendedContents = true;