@@ -49,6 +49,88 @@ buildGoModule (finalAttrs: {
4949 # Many checks require a containerd socket and running nerdctl after it's built
5050 doCheck = false ;
5151
52+ postPatch = lib . optionalString stdenv . hostPlatform . isDarwin ''
53+ cat > pkg/defaults/defaults_darwin.go <<'EOF'
54+ /*
55+ Copyright The containerd Authors.
56+
57+ Licensed under the Apache License, Version 2.0 (the "License");
58+ you may not use this file except in compliance with the License.
59+ You may obtain a copy of the License at
60+
61+ http://www.apache.org/licenses/LICENSE-2.0
62+
63+ Unless required by applicable law or agreed to in writing, software
64+ distributed under the License is distributed on an "AS IS" BASIS,
65+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
66+ See the License for the specific language governing permissions and
67+ limitations under the License.
68+ */
69+
70+ // This is a dummy file to allow usage of library functions
71+ // on Darwin-based systems.
72+ // All functions and variables are empty/no-ops
73+
74+ package defaults
75+
76+ import (
77+ "os"
78+ "path/filepath"
79+
80+ gocni "github.com/containerd/go-cni"
81+ )
82+
83+ const (
84+ AppArmorProfileName = ""
85+ SeccompProfileName = ""
86+ Runtime = ""
87+ )
88+
89+ func CNIPath() string {
90+ return gocni.DefaultCNIDir
91+ }
92+
93+ func CNIRuntimeDir() (string, error) {
94+ return "/var/run/cni", nil
95+ }
96+
97+ func CNINetConfPath() string {
98+ return gocni.DefaultNetDir
99+ }
100+
101+ func DataRoot() string {
102+ if home, err := os.UserHomeDir(); err == nil && home != "" {
103+ return filepath.Join(home, ".local", "share", "nerdctl")
104+ }
105+ return "/var/lib/nerdctl"
106+ }
107+
108+ func CgroupManager() string {
109+ return ""
110+ }
111+
112+ func CgroupnsMode() string {
113+ return ""
114+ }
115+
116+ func NerdctlTOML() string {
117+ return "/etc/nerdctl/nerdctl.toml"
118+ }
119+
120+ func HostsDirs() []string {
121+ return []string{}
122+ }
123+
124+ func HostGatewayIP() string {
125+ return ""
126+ }
127+
128+ func CDISpecDirs() []string {
129+ return []string{"/etc/cdi", "/var/run/cdi"}
130+ }
131+ EOF
132+ '' ;
133+
52134 postInstall = ''
53135 wrapProgram $out/bin/nerdctl \
54136 --prefix PATH : "${ lib . makeBinPath ( [ buildkit ] ++ extraPackages ) } "${ lib . optionalString stdenv . hostPlatform . isLinux '' \
0 commit comments