dockerTools: support meta attribute
I want to be able to set descriptions on my docker image derivations since these can be ingested by various tooling for helpfulness.
This commit is contained in:
@@ -202,6 +202,10 @@ Similarly, if you encounter errors similar to `Error_Protocol ("certificate has
|
||||
|
||||
_Default value:_ `false`.
|
||||
|
||||
`meta` (Attribute Set)
|
||||
|
||||
: The `meta` attribute of the resulting derivation, as in `stdenv.mkDerivation`. Accepts `description`, `maintainers` and any other `meta` attributes.
|
||||
|
||||
`contents` **DEPRECATED**
|
||||
|
||||
: This attribute is deprecated, and users are encouraged to use `copyToRoot` instead.
|
||||
@@ -635,6 +639,10 @@ This allows the function to produce reproducible images.
|
||||
|
||||
_Default value:_ `false`.
|
||||
|
||||
`meta` (Attribute Set)
|
||||
|
||||
: The `meta` attribute of the resulting derivation, as in `stdenv.mkDerivation`. Accepts `description`, `maintainers` and any other `meta` attributes.
|
||||
|
||||
`passthru` (Attribute Set; _optional_)
|
||||
|
||||
: Use this to pass any attributes as [`passthru`](#chap-passthru) for the resulting derivation.
|
||||
|
||||
@@ -579,10 +579,16 @@ rec {
|
||||
{
|
||||
name,
|
||||
compressor ? "gz",
|
||||
meta ? { },
|
||||
...
|
||||
}@args:
|
||||
let
|
||||
stream = streamLayeredImage (removeAttrs args [ "compressor" ]);
|
||||
stream = streamLayeredImage (
|
||||
removeAttrs args [
|
||||
"compressor"
|
||||
"meta"
|
||||
]
|
||||
);
|
||||
compress = compressorForImage compressor name;
|
||||
in
|
||||
runCommand "${baseNameOf name}.tar${compress.ext}" {
|
||||
@@ -592,6 +598,7 @@ rec {
|
||||
inherit stream;
|
||||
};
|
||||
nativeBuildInputs = compress.nativeInputs;
|
||||
inherit meta;
|
||||
} "${stream} | ${compress.compress} > $out"
|
||||
);
|
||||
|
||||
@@ -641,6 +648,8 @@ rec {
|
||||
includeNixDB ? false,
|
||||
# Deprecated.
|
||||
contents ? null,
|
||||
# Meta options to set on the resulting derivation.
|
||||
meta ? { },
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -735,6 +744,7 @@ rec {
|
||||
lib.head (
|
||||
lib.strings.splitString "-" (baseNameOf (builtins.unsafeDiscardStringContext result.outPath))
|
||||
);
|
||||
inherit meta;
|
||||
}
|
||||
''
|
||||
${lib.optionalString (tag == null) ''
|
||||
@@ -1008,6 +1018,7 @@ rec {
|
||||
includeStorePaths ? true,
|
||||
includeNixDB ? false,
|
||||
passthru ? { },
|
||||
meta ? { },
|
||||
# Pipeline used to produce docker layers. If not set, popularity contest
|
||||
# algorithm is used. If set, maxLayers is ignored as the author of the
|
||||
# pipeline can use one of the available functions (like "limit_layers")
|
||||
@@ -1233,6 +1244,7 @@ rec {
|
||||
isExe = true;
|
||||
};
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
inherit meta;
|
||||
}
|
||||
''
|
||||
makeWrapper $streamScript $out --add-flags $conf
|
||||
|
||||
@@ -77,6 +77,8 @@ let
|
||||
"${nginxPort}/tcp" = { };
|
||||
};
|
||||
};
|
||||
|
||||
meta.description = "Basic nginx docker image example";
|
||||
};
|
||||
|
||||
in
|
||||
@@ -91,6 +93,8 @@ rec {
|
||||
paths = [ pkgs.bashInteractive ];
|
||||
pathsToLink = [ "/bin" ];
|
||||
};
|
||||
|
||||
meta.description = "Basic example image";
|
||||
};
|
||||
|
||||
# 2. service example, layered on another image
|
||||
@@ -138,6 +142,8 @@ rec {
|
||||
Retries = 3;
|
||||
};
|
||||
};
|
||||
|
||||
meta.description = "Service example, layered on another image";
|
||||
};
|
||||
|
||||
# 3. another service example
|
||||
@@ -204,6 +210,8 @@ rec {
|
||||
"USER=nobody"
|
||||
];
|
||||
};
|
||||
|
||||
meta.description = "nix example to play with the container nix store";
|
||||
};
|
||||
|
||||
# 7. example of adding something on top of an image pull by our
|
||||
|
||||
Reference in New Issue
Block a user