ddev: make docker-buildx available (#494539)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
diff --git a/cli-plugins/manager/manager_unix.go b/cli-plugins/manager/manager_unix.go
|
||||
index f546dc3849..5e3ae08dbc 100644
|
||||
--- a/cli-plugins/manager/manager_unix.go
|
||||
+++ b/cli-plugins/manager/manager_unix.go
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
package manager
|
||||
|
||||
+import (
|
||||
+ "os"
|
||||
+ "path/filepath"
|
||||
+)
|
||||
+
|
||||
// defaultSystemPluginDirs are the platform-specific locations to search
|
||||
// for plugins in order of preference.
|
||||
//
|
||||
@@ -12,9 +17,8 @@
|
||||
// 3. Platform-specific defaultSystemPluginDirs (as defined below).
|
||||
//
|
||||
// [ConfigFile.CLIPluginsExtraDirs]: https://pkg.go.dev/github.com/docker/cli@v26.1.4+incompatible/cli/config/configfile#ConfigFile.CLIPluginsExtraDirs
|
||||
-var defaultSystemPluginDirs = []string{
|
||||
- "/usr/local/lib/docker/cli-plugins",
|
||||
- "/usr/local/libexec/docker/cli-plugins",
|
||||
- "/usr/lib/docker/cli-plugins",
|
||||
- "/usr/libexec/docker/cli-plugins",
|
||||
+var defaultSystemPluginDirs []string
|
||||
+
|
||||
+func init() {
|
||||
+ defaultSystemPluginDirs = filepath.SplitList(os.Getenv("DOCKER_CLI_PLUGIN_DIRS"))
|
||||
}
|
||||
|
||||
@@ -2,12 +2,22 @@
|
||||
lib,
|
||||
stdenv,
|
||||
buildGoModule,
|
||||
docker-buildx,
|
||||
fetchFromGitHub,
|
||||
installShellFiles,
|
||||
makeBinaryWrapper,
|
||||
versionCheckHook,
|
||||
writableTmpDirAsHomeHook,
|
||||
}:
|
||||
|
||||
let
|
||||
dockerCliPlugins = [
|
||||
docker-buildx
|
||||
];
|
||||
dockerCliPluginsDirs = lib.strings.concatStringsSep ":" (
|
||||
map (p: "${p}/libexec/docker/cli-plugins") dockerCliPlugins
|
||||
);
|
||||
in
|
||||
buildGoModule (finalAttrs: {
|
||||
pname = "ddev";
|
||||
version = "1.25.1";
|
||||
@@ -19,7 +29,12 @@ buildGoModule (finalAttrs: {
|
||||
hash = "sha256-kHGGUFX/xlmQsYxKPxSuRJHk2na9gU1Kd2jhNclAp5s=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
(cd vendor/github.com/docker/cli && patch ${./cli-system-plugin-dir-from-env.patch})
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeBinaryWrapper
|
||||
installShellFiles
|
||||
];
|
||||
|
||||
@@ -34,7 +49,13 @@ buildGoModule (finalAttrs: {
|
||||
# Tests need docker.
|
||||
doCheck = false;
|
||||
|
||||
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
postInstall = ''
|
||||
# make buildx available, it is a docker plugin which docker-compose uses and thus DDEV requires
|
||||
# https://github.com/NixOS/nixpkgs/blob/43fc054052db6ca5df042dcbe823740aa6c9a7c2/pkgs/applications/virtualization/docker/default.nix#L339
|
||||
wrapProgram $out/bin/ddev \
|
||||
--prefix DOCKER_CLI_PLUGIN_DIRS : "${dockerCliPluginsDirs}"
|
||||
''
|
||||
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
# DDEV will try to create $HOME/.ddev, so we set $HOME to a temporary
|
||||
# directory.
|
||||
export HOME=$(mktemp -d)
|
||||
|
||||
Reference in New Issue
Block a user