From de9930171a1ffff5e0df2777b69be734b731e359 Mon Sep 17 00:00:00 2001 From: Qaif Shaikh <72766392+qaifshaikh@users.noreply.github.com> Date: Thu, 23 Feb 2023 13:04:59 -0600 Subject: [PATCH 1/3] Add support for volumes to mount host paths --- src/nix/modules/composition/docker-compose.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/nix/modules/composition/docker-compose.nix b/src/nix/modules/composition/docker-compose.nix index a74c958..799c061 100644 --- a/src/nix/modules/composition/docker-compose.nix +++ b/src/nix/modules/composition/docker-compose.nix @@ -63,6 +63,11 @@ in type = lib.types.attrsOf (lib.types.submodule service); description = "An attribute set of service configurations. A service specifies how to run an image as a container."; }; + docker-compose.volumes = lib.mkOption { + type = lib.types.anything; + description = "A attribute set of volume configurations."; + default = {}; + }; }; config = { out.dockerComposeYaml = pkgs.writeText "docker-compose.yaml" config.out.dockerComposeYamlText; @@ -73,6 +78,7 @@ in version = "3.4"; services = lib.mapAttrs (k: c: c.out.service) config.services; x-arion = config.docker-compose.extended; + volumes = config.docker-compose.volumes; }; }; } From cb137954089b6cc61039331bba4364f7259d9406 Mon Sep 17 00:00:00 2001 From: Qaif Shaikh <72766392+qaifshaikh@users.noreply.github.com> Date: Tue, 28 Feb 2023 16:52:18 -0600 Subject: [PATCH 2/3] Use service submodule for volumes type --- src/nix/modules/composition/docker-compose.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nix/modules/composition/docker-compose.nix b/src/nix/modules/composition/docker-compose.nix index 799c061..6555e6b 100644 --- a/src/nix/modules/composition/docker-compose.nix +++ b/src/nix/modules/composition/docker-compose.nix @@ -64,7 +64,7 @@ in description = "An attribute set of service configurations. A service specifies how to run an image as a container."; }; docker-compose.volumes = lib.mkOption { - type = lib.types.anything; + type = lib.types.attrsOf (lib.types.submodule service.volumes); description = "A attribute set of volume configurations."; default = {}; }; From 5ba2990f72354a2c089a398ced9203db71d71a80 Mon Sep 17 00:00:00 2001 From: Qaif Shaikh <72766392+qaifshaikh@users.noreply.github.com> Date: Thu, 2 Mar 2023 13:41:53 -0600 Subject: [PATCH 3/3] Try with lib.types.unspecified --- src/haskell/testdata/Arion/NixSpec/arion-compose.json | 1 + src/nix/modules/composition/docker-compose.nix | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/haskell/testdata/Arion/NixSpec/arion-compose.json b/src/haskell/testdata/Arion/NixSpec/arion-compose.json index 5f644ac..64b8169 100644 --- a/src/haskell/testdata/Arion/NixSpec/arion-compose.json +++ b/src/haskell/testdata/Arion/NixSpec/arion-compose.json @@ -33,6 +33,7 @@ } }, "version": "3.4", + "volumes": {}, "x-arion": { "images": [ { diff --git a/src/nix/modules/composition/docker-compose.nix b/src/nix/modules/composition/docker-compose.nix index 6555e6b..8ff3f62 100644 --- a/src/nix/modules/composition/docker-compose.nix +++ b/src/nix/modules/composition/docker-compose.nix @@ -64,7 +64,7 @@ in description = "An attribute set of service configurations. A service specifies how to run an image as a container."; }; docker-compose.volumes = lib.mkOption { - type = lib.types.attrsOf (lib.types.submodule service.volumes); + type = lib.types.attrsOf lib.types.unspecified; description = "A attribute set of volume configurations."; default = {}; };