diff --git a/flake.nix b/flake.nix index e33bd58..e26f196 100644 --- a/flake.nix +++ b/flake.nix @@ -44,7 +44,6 @@ # https://nixos.org/manual/nixos/stable/#sec-option-declarations paths = mkOption { type = types.listOf types.path; - default = []; description = lib.mdDoc "One or more paths to Docker Compose files."; }; runtime = mkOption { @@ -87,13 +86,17 @@ default = true; description = lib.mdDoc "Auto-start all containers."; }; + output = mkOption { + type = types.anything; + description = lib.mdDoc "Output config."; + }; }; - config.compose2nix = mkIf (cfg.paths != []) { - # runCommandLocal ensures that we always build this derivation on the local machine. - # This allows us to circumvent the Nix binary cache and minimize the time spent outside - # of building the derivation. - # https://nixos.org/manual/nixpkgs/stable/#trivial-builder-runCommandLocal - output = pkgs.runCommandLocal "run-compose2nix" { + # runCommandLocal ensures that we always build this derivation on the local machine. + # This allows us to circumvent the Nix binary cache and minimize the time spent outside + # of building the derivation. + # https://nixos.org/manual/nixpkgs/stable/#trivial-builder-runCommandLocal + config = { + compose2nix.output = mkIf (cfg.paths != []) (import pkgs.runCommandLocal "compose2nix" { env = cfg.env; buildInputs = [ pkgs.compose2nix ]; } '' @@ -107,7 +110,7 @@ -service_include='${cfg.serviceInclude}' \ -auto_start=${cfg.autoStart} \ -output=$out - ''; + ''); }; }; }); diff --git a/templates/main.nix.tmpl b/templates/main.nix.tmpl index 7499347..a2ab686 100644 --- a/templates/main.nix.tmpl +++ b/templates/main.nix.tmpl @@ -1,5 +1,5 @@ {{- $runtime := .Runtime | printf "%s" -}} -{ pkgs, ... }: +{ ... }: { # Runtime diff --git a/testdata/TestDocker_WithProject_out.nix b/testdata/TestDocker_WithProject_out.nix index b0b8c2c..9f28ace 100644 --- a/testdata/TestDocker_WithProject_out.nix +++ b/testdata/TestDocker_WithProject_out.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ ... }: { # Runtime diff --git a/testdata/TestDocker_out.nix b/testdata/TestDocker_out.nix index fcb1383..8d1e2f5 100644 --- a/testdata/TestDocker_out.nix +++ b/testdata/TestDocker_out.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ ... }: { # Runtime diff --git a/testdata/TestPodman_WithProject_out.nix b/testdata/TestPodman_WithProject_out.nix index 4fc7dab..11478f6 100644 --- a/testdata/TestPodman_WithProject_out.nix +++ b/testdata/TestPodman_WithProject_out.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ ... }: { # Runtime diff --git a/testdata/TestPodman_out.nix b/testdata/TestPodman_out.nix index da69ab9..38890c0 100644 --- a/testdata/TestPodman_out.nix +++ b/testdata/TestPodman_out.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ ... }: { # Runtime