Make the service name available to the service config
This commit is contained in:
parent
6fd435c38e
commit
00f7b3e711
4 changed files with 12 additions and 3 deletions
|
@ -61,7 +61,7 @@ let
|
||||||
declarations = map (d: "src/nix" + (lib.strings.removePrefix (toString ${src}) (toString d))) opt.declarations;
|
declarations = map (d: "src/nix" + (lib.strings.removePrefix (toString ${src}) (toString d))) opt.declarations;
|
||||||
};
|
};
|
||||||
inherit (pkgs) lib;
|
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))
|
in map fixPaths (lib.filter (opt: opt.visible && !opt.internal) (lib.optionAttrSetToDocList composition.options))
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ lib, pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
{ modules, host }:
|
{ modules, host, name }:
|
||||||
let
|
let
|
||||||
composite = lib.evalModules {
|
composite = lib.evalModules {
|
||||||
check = true;
|
check = true;
|
||||||
|
@ -21,6 +21,7 @@ let
|
||||||
key = ./docker-compose.nix;
|
key = ./docker-compose.nix;
|
||||||
config._module.args.pkgs = lib.mkForce pkgs;
|
config._module.args.pkgs = lib.mkForce pkgs;
|
||||||
config.host = host;
|
config.host = host;
|
||||||
|
config.service.name = name;
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
*/
|
*/
|
||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
let
|
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
|
in
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,14 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
service.name = mkOption {
|
||||||
|
type = str;
|
||||||
|
description = ''
|
||||||
|
The name of the service - <code><name></code> in the composition-level <code>docker-compose.services.<name></code>
|
||||||
|
'';
|
||||||
|
readOnly = true;
|
||||||
|
};
|
||||||
|
|
||||||
service.volumes = mkOption {
|
service.volumes = mkOption {
|
||||||
type = listOf types.unspecified;
|
type = listOf types.unspecified;
|
||||||
default = [];
|
default = [];
|
||||||
|
|
Loading…
Reference in a new issue