diff --git a/doc/manual/default.nix b/doc/manual/default.nix
index 59f62ab..8038f8c 100644
--- a/doc/manual/default.nix
+++ b/doc/manual/default.nix
@@ -61,7 +61,7 @@ let
declarations = map (d: "src/nix" + (lib.strings.removePrefix (toString ${src}) (toString d))) opt.declarations;
};
inherit (pkgs) lib;
- composition = pkgs.callPackage ${src}/eval-service.nix {} { modules = []; host = {}; };
+ composition = pkgs.callPackage ${src}/eval-service.nix {} { modules = []; host = {}; name = abort "The manual's service options section must not depend on the service name."; };
in map fixPaths (lib.filter (opt: opt.visible && !opt.internal) (lib.optionAttrSetToDocList composition.options))
'';
};
diff --git a/src/nix/eval-service.nix b/src/nix/eval-service.nix
index f2273d1..c1cb667 100644
--- a/src/nix/eval-service.nix
+++ b/src/nix/eval-service.nix
@@ -1,6 +1,6 @@
{ lib, pkgs, ... }:
-{ modules, host }:
+{ modules, host, name }:
let
composite = lib.evalModules {
check = true;
@@ -21,6 +21,7 @@ let
key = ./docker-compose.nix;
config._module.args.pkgs = lib.mkForce pkgs;
config.host = host;
+ config.service.name = name;
};
in
diff --git a/src/nix/modules/composition/docker-compose.nix b/src/nix/modules/composition/docker-compose.nix
index 8ce8393..6f0d2d8 100644
--- a/src/nix/modules/composition/docker-compose.nix
+++ b/src/nix/modules/composition/docker-compose.nix
@@ -11,7 +11,7 @@
*/
{ pkgs, lib, config, ... }:
let
-evalService = name: modules: (pkgs.callPackage ../../eval-service.nix {} { inherit modules; inherit (config) host; }).config.build.service;
+ evalService = name: modules: (pkgs.callPackage ../../eval-service.nix {} { inherit name modules; inherit (config) host; }).config.build.service;
in
{
diff --git a/src/nix/modules/service/docker-compose-service.nix b/src/nix/modules/service/docker-compose-service.nix
index b708e4a..25a9f8d 100644
--- a/src/nix/modules/service/docker-compose-service.nix
+++ b/src/nix/modules/service/docker-compose-service.nix
@@ -33,6 +33,14 @@ in
'';
};
+ service.name = mkOption {
+ type = str;
+ description = ''
+ The name of the service - <name>
in the composition-level docker-compose.services.<name>
+ '';
+ readOnly = true;
+ };
+
service.volumes = mkOption {
type = listOf types.unspecified;
default = [];