From 0ee76740d0985989a49603894059c8131ada74ef Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 23 Apr 2022 23:09:54 +0200 Subject: [PATCH] image.name: Default to localhost/$name --- docs/modules/ROOT/partials/NixOSOptions.adoc | 2 +- src/haskell/lib/Arion/Images.hs | 3 ++- src/haskell/testdata/Arion/NixSpec/arion-compose.json | 4 ++-- src/nix/modules/service/image.nix | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/modules/ROOT/partials/NixOSOptions.adoc b/docs/modules/ROOT/partials/NixOSOptions.adoc index 14efd31..3ba49a3 100644 --- a/docs/modules/ROOT/partials/NixOSOptions.adoc +++ b/docs/modules/ROOT/partials/NixOSOptions.adoc @@ -233,7 +233,7 @@ Type:: string Default:: + ---- -{"_type":"literalExpression","text":"config.service.name"} +{"_type":"literalExpression","text":"\"localhost/\" + config.service.name"} ---- diff --git a/src/haskell/lib/Arion/Images.hs b/src/haskell/lib/Arion/Images.hs index da2ad3c..9869d33 100644 --- a/src/haskell/lib/Arion/Images.hs +++ b/src/haskell/lib/Arion/Images.hs @@ -25,7 +25,8 @@ loadImages requestedImages = do isNew i = -- On docker, the image name is unmodified (imageName i <> ":" <> imageTag i) `notElem` loaded - -- -- On podman, you automatically get a localhost prefix + -- On podman, you used to automatically get a localhost prefix + -- however, since NixOS 22.05, this expected to be part of the name instead && ("localhost/" <> imageName i <> ":" <> imageTag i) `notElem` loaded traverse_ loadImage . filter isNew $ requestedImages diff --git a/src/haskell/testdata/Arion/NixSpec/arion-compose.json b/src/haskell/testdata/Arion/NixSpec/arion-compose.json index 83d62fc..972db6f 100644 --- a/src/haskell/testdata/Arion/NixSpec/arion-compose.json +++ b/src/haskell/testdata/Arion/NixSpec/arion-compose.json @@ -9,7 +9,7 @@ "PATH": "/usr/bin:/run/current-system/sw/bin/", "container": "docker" }, - "image": "webserver:", + "image": "localhost/webserver:", "ports": [ "8000:80" ], @@ -32,7 +32,7 @@ "images": [ { "imageExe": "", - "imageName": "webserver", + "imageName": "localhost/webserver", "imageTag": "" } ], diff --git a/src/nix/modules/service/image.nix b/src/nix/modules/service/image.nix index 1f1e755..8700396 100644 --- a/src/nix/modules/service/image.nix +++ b/src/nix/modules/service/image.nix @@ -104,8 +104,8 @@ in }; image.name = mkOption { type = str; - default = config.service.name; - defaultText = lib.literalExpression or lib.literalExample "config.service.name"; + default = "localhost/" + config.service.name; + defaultText = lib.literalExpression or lib.literalExample ''"localhost/" + config.service.name''; description = '' A human readable name for the docker image.