From c8944a287111539c4187bbc2282e720f565e76dc Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Thu, 9 Jun 2022 01:20:09 +0200 Subject: [PATCH] Extract dockerComposeRef and link into new lib.nix --- src/nix/lib.nix | 16 ++++++++++++++++ .../modules/service/docker-compose-service.nix | 9 +++++---- 2 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 src/nix/lib.nix diff --git a/src/nix/lib.nix b/src/nix/lib.nix new file mode 100644 index 0000000..1e3ede6 --- /dev/null +++ b/src/nix/lib.nix @@ -0,0 +1,16 @@ +{ lib }: +let + + link = url: text: + ''link:${url}[${text}]''; + + dockerComposeRef = fragment: + ''See ${link "https://docs.docker.com/compose/compose-file/#${fragment}" "Docker Compose#${fragment}"}''; + +in +{ + inherit + dockerComposeRef + link + ; +} diff --git a/src/nix/modules/service/docker-compose-service.nix b/src/nix/modules/service/docker-compose-service.nix index 6b64e84..350c215 100644 --- a/src/nix/modules/service/docker-compose-service.nix +++ b/src/nix/modules/service/docker-compose-service.nix @@ -10,10 +10,11 @@ let inherit (lib) mkOption types; inherit (types) listOf nullOr attrsOf str either int bool submodule enum; - link = url: text: - ''link:${url}[${text}]''; - dockerComposeRef = fragment: - ''See ${link "https://docs.docker.com/compose/compose-file/#${fragment}" "Docker Compose#${fragment}"}''; + inherit (import ../../lib.nix { inherit lib; }) + link + dockerComposeRef + ; + dockerComposeKitchenSink = '' Analogous to the `docker run` counterpart.