mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 07:13:23 +01:00
29 lines
637 B
Nix
29 lines
637 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.docker-containers;
|
|
|
|
containerModule = {
|
|
script = mkOption {
|
|
type = types.lines;
|
|
description = "Shell commands executed as the service's main process.";
|
|
};
|
|
};
|
|
|
|
toContainer = name: value: pkgs.dockerTools.buildImage {
|
|
inherit name;
|
|
config = {
|
|
Cmd = [ value.script ];
|
|
};
|
|
};
|
|
in {
|
|
options.docker-containers = mkOption {
|
|
default = {};
|
|
type = with types; attrsOf (types.submodule containerModule);
|
|
description = "Definition of docker containers";
|
|
};
|
|
|
|
config.system.build.toplevel-docker = lib.mapAttrs toContainer cfg;
|
|
}
|