image.name: Default to localhost/$name

This commit is contained in:
Robert Hensing 2022-04-23 23:09:54 +02:00
parent 40fd74e71f
commit 0ee76740d0
4 changed files with 7 additions and 6 deletions

View file

@ -233,7 +233,7 @@ Type:: string
Default:: Default::
+ +
---- ----
{"_type":"literalExpression","text":"config.service.name"} {"_type":"literalExpression","text":"\"localhost/\" + config.service.name"}
---- ----

View file

@ -25,7 +25,8 @@ loadImages requestedImages = do
isNew i = isNew i =
-- On docker, the image name is unmodified -- On docker, the image name is unmodified
(imageName i <> ":" <> imageTag i) `notElem` loaded (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 && ("localhost/" <> imageName i <> ":" <> imageTag i) `notElem` loaded
traverse_ loadImage . filter isNew $ requestedImages traverse_ loadImage . filter isNew $ requestedImages

View file

@ -9,7 +9,7 @@
"PATH": "/usr/bin:/run/current-system/sw/bin/", "PATH": "/usr/bin:/run/current-system/sw/bin/",
"container": "docker" "container": "docker"
}, },
"image": "webserver:<HASH>", "image": "localhost/webserver:<HASH>",
"ports": [ "ports": [
"8000:80" "8000:80"
], ],
@ -32,7 +32,7 @@
"images": [ "images": [
{ {
"imageExe": "<STOREPATH>", "imageExe": "<STOREPATH>",
"imageName": "webserver", "imageName": "localhost/webserver",
"imageTag": "<HASH>" "imageTag": "<HASH>"
} }
], ],

View file

@ -104,8 +104,8 @@ in
}; };
image.name = mkOption { image.name = mkOption {
type = str; type = str;
default = config.service.name; default = "localhost/" + config.service.name;
defaultText = lib.literalExpression or lib.literalExample "config.service.name"; defaultText = lib.literalExpression or lib.literalExample ''"localhost/" + config.service.name'';
description = '' description = ''
A human readable name for the docker image. A human readable name for the docker image.