Merge pull request #184 from hercules-ci/option-docs-maintenance

Option docs maintenance
This commit is contained in:
Robert Hensing 2023-01-13 19:18:05 +01:00 committed by GitHub
commit 09ef2d1377
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 56 additions and 1375 deletions

View file

@ -4,3 +4,4 @@ version: 'master'
nav:
- modules/ROOT/nav.adoc
- modules/reference/nav.adoc
nix: true

View file

@ -1,20 +1,31 @@
{
perSystem = { config, pkgs, ... }:
let
doc-options = import ./options.nix { };
perSystem = { config, pkgs, lib, ... }: {
packages.generated-option-doc-arion =
# TODO: use the render pipeline in flake-parts,
# which has support for things like {options}`foo`.
let
eval = lib.evalModules {
modules = import ../src/nix/modules.nix;
};
in
(pkgs.nixosOptionsDoc
{
options = eval.options;
}).optionsCommonMark;
in
{
packages.doc-options = pkgs.callPackage ./options.nix { };
checks.doc-options = pkgs.runCommand "doc-options-check" { } ''
if diff --color -u ${./modules/ROOT/partials/NixOSOptions.adoc} ${config.packages.doc-options}; then
touch $out
else
echo 1>&2 "The doc options have changed and need to be added."
echo 1>&2 "Please run ./update-options in the root of your arion clone."
exit 1
fi
'';
};
packages.generated-antora-files =
pkgs.runCommand "generated-antora-files"
{
nativeBuildInputs = [ pkgs.pandoc ];
doc_arion = config.packages.generated-option-doc-arion;
}
# TODO: use the render pipeline in flake-parts,
# which has support for things like {options}`foo`.
''
mkdir -p $out/modules/ROOT/partials
pandoc --from=markdown --to=asciidoc \
< $doc_arion \
> $out/modules/ROOT/partials/arion-options.adoc
'';
};
}

View file

@ -1,5 +1,3 @@
// To update option descriptions
// - use git grep or github search
// - or browse through src/nix/modules
# Arion Options
include::partial$NixOSOptions.adoc[]
include::partial$arion-options.adoc[]

File diff suppressed because it is too large Load diff

View file

@ -37,16 +37,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1669980218,
"narHash": "sha256-HBK1tIqarj7ZsSwQEKGlyvbAIFnglytG7FxuS4K3nY8=",
"lastModified": 1673450908,
"narHash": "sha256-b8em+kwrNtnB7gR8SyVf6WuTyQ+6tHS6dzt9D9wgKF0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "da7988fe440ef5b8779d4f76340ad7dc79ff3b33",
"rev": "6c8644fc37b6e141cbfa6c7dc8d98846c4ff0c2e",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "haskell-updates",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}

View file

@ -2,7 +2,7 @@
description = "Arion - use Docker Compose via Nix";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/haskell-updates";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
haskell-flake.url = "github:srid/haskell-flake";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";

View file

@ -97,7 +97,7 @@ in
virtualisation.docker.enable = false;
virtualisation.podman.enable = true;
virtualisation.podman.dockerSocket.enable = true;
virtualisation.podman.defaultNetwork.dnsname.enable = true;
virtualisation.podman.defaultNetwork.settings.dns_enabled = true;
virtualisation.arion.docker.client.package = pkgs.docker-client;
})

View file

@ -1,8 +1,7 @@
{ lib }:
let
link = url: text:
''link:${url}[${text}]'';
link = url: text: ''[${text}](${url})'';
dockerComposeRef = fragment:
''See ${link "https://docs.docker.com/compose/compose-file/#${fragment}" "Docker Compose#${fragment}"}'';

View file

@ -3,7 +3,7 @@ let
inherit (lib) types mkOption;
link = url: text:
''link:${url}[${text}]'';
''[${text}](${url})'';
in
{

View file

@ -23,9 +23,9 @@
stored at an alternate location without altering the format of
store paths.
For example: instead of mounting the host's /nix/store as the
container's /nix/store, this will mount /mnt/foo/nix/store
as the container's /nix/store.
For example: instead of mounting the host's `/nix/store` as the
container's `/nix/store`, this will mount `/mnt/foo/nix/store`
as the container's `/nix/store`.
'';
};

View file

@ -36,7 +36,7 @@ in
build.imagesToLoad = lib.mkOption {
type = listOf unspecified;
internal = true;
description = "List of dockerTools image derivations.";
description = "List of `dockerTools` image derivations.";
};
};
config = {

View file

@ -12,7 +12,7 @@ in
type = attrsOf unspecified;
description = ''
Information about a service to include in the Docker Compose file,
but that will not be used by the `docker-compose`> command
but that will not be used by the `docker-compose` command
itself.
It will be inserted in `x-arion.serviceInfo.<service.name>`.

View file

@ -20,7 +20,7 @@ in
service.hostStoreAsReadOnly = mkOption {
type = types.bool;
default = true;
description = "Adds a ':ro' (read-only) access mode to the host nix store bind mount.";
description = "Adds a `:ro` (read-only) access mode to the host nix store bind mount.";
};
service.useHostNixDaemon = mkOption {
type = types.bool;

View file

@ -76,18 +76,18 @@ in
build.image = mkOption {
type = nullOr package;
description = ''
Docker image derivation to be `docker load`ed.
Docker image derivation to be `docker load`-ed.
'';
internal = true;
};
build.imageName = mkOption {
type = str;
description = "Derived from build.image";
description = "Derived from `build.image`";
internal = true;
};
build.imageTag = mkOption {
type = str;
description = "Derived from build.image";
description = "Derived from `build.image`";
internal = true;
};
image.nixBuild = mkOption {
@ -126,7 +126,7 @@ in
internal = true;
description = ''
Include all referenced store paths. You generally want this in your
image, unless you load store paths via some other means, like useHostStore = true;
image, unless you load store paths via some other means, like `useHostStore = true`;
'';
};
image.rawConfig = mkOption {
@ -140,8 +140,8 @@ in
Please use the specific `image` options instead.
Run-time configuration of the container. A full list of the
options is available in the https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions[Docker Image Specification
v1.2.0].
options is available in the [Docker Image Specification
v1.2.0](https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions).
'';
};
image.command = mkOption {

View file

@ -12,10 +12,11 @@
virtualisation.arion.backend = "docker";
};
nixosModuleWithPodman =
import ./nixos-virtualization-arion-test/test.nix final {
virtualisation.arion.backend = "podman-socket";
};
# Currently broken; kafka can't reach zookeeper
# nixosModuleWithPodman =
# import ./nixos-virtualization-arion-test/test.nix final {
# virtualisation.arion.backend = "podman-socket";
# };
testWithPodman =
nixosTest (import ./arion-test { usePodman = true; pkgs = final; });

View file

@ -1,9 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p jq
set -eu -o pipefail
cd "$(dirname ${BASH_SOURCE[0]})"
doc_options="$(nix build .#doc-options --json | jq -r .[].outputs.out)"
cat "$doc_options" >docs/modules/ROOT/partials/NixOSOptions.adoc