Expose composition to services
This commit is contained in:
parent
a90190fc9e
commit
02d319acf6
4 changed files with 15 additions and 4 deletions
|
@ -69,7 +69,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 = {}; name = abort "The manual's service options section must not depend on the service name."; };
|
composition = pkgs.callPackage ${src}/eval-service.nix {} { modules = []; host = {}; name = abort "The manual's service options section must not depend on the service name."; composition = abort "The manual's service options must not depend on the composition."; };
|
||||||
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, name }:
|
{ modules, host, name, composition }:
|
||||||
let
|
let
|
||||||
composite = lib.evalModules {
|
composite = lib.evalModules {
|
||||||
check = true;
|
check = true;
|
||||||
|
@ -13,7 +13,7 @@ let
|
||||||
./modules/service/docker-compose-service.nix
|
./modules/service/docker-compose-service.nix
|
||||||
./modules/service/extended-info.nix
|
./modules/service/extended-info.nix
|
||||||
./modules/service/host-store.nix
|
./modules/service/host-store.nix
|
||||||
./modules/service/host.nix
|
./modules/service/context.nix
|
||||||
./modules/service/image.nix
|
./modules/service/image.nix
|
||||||
./modules/service/nixos.nix
|
./modules/service/nixos.nix
|
||||||
./modules/service/nixos-init.nix
|
./modules/service/nixos-init.nix
|
||||||
|
@ -25,6 +25,7 @@ let
|
||||||
config._module.args.pkgs = lib.mkForce pkgs;
|
config._module.args.pkgs = lib.mkForce pkgs;
|
||||||
config.host = host;
|
config.host = host;
|
||||||
config.service.name = name;
|
config.service.name = name;
|
||||||
|
config.composition = composition;
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
|
@ -11,7 +11,11 @@
|
||||||
*/
|
*/
|
||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
let
|
let
|
||||||
evalService = name: modules: pkgs.callPackage ../../eval-service.nix {} { inherit name modules; inherit (config) host; };
|
evalService = name: modules: pkgs.callPackage ../../eval-service.nix {} {
|
||||||
|
inherit name modules;
|
||||||
|
inherit (config) host;
|
||||||
|
composition = config;
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,5 +7,11 @@
|
||||||
The composition-level host option values.
|
The composition-level host option values.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
composition = lib.mkOption {
|
||||||
|
type = lib.types.attrs;
|
||||||
|
description = ''
|
||||||
|
The composition configuration.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Reference in a new issue