Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.

Commit e13610a

Browse files
authored
fix: update docker files and readme command (#239)
1 parent ed5722d commit e13610a

3 files changed

Lines changed: 23 additions & 20 deletions

File tree

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,8 @@ We also provide Docker containers for CI builds. For a quick build:
5252
# Using the prebuilt container
5353
cd examples/activation
5454
docker run --rm \
55-
-v $(pwd):/app \
56-
-w /app \
57-
ghcr.io/huggingface/kernel-builder:{SHA} \
58-
build
55+
--mount type=bind,source=$(pwd),target=/kernelcode \
56+
-w /kernelcode ghcr.io/huggingface/kernel-builder:main build
5957
```
6058

6159
See [dockerfiles/README.md](./dockerfiles/README.md) for more options, including a user-level container for CI/CD environments.

dockerfiles/Dockerfile

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM nixos/nix:2.18.8
1+
FROM nixos/nix:2.30.3
22

33
# default build args
44
ARG MAX_JOBS=4
@@ -100,21 +100,15 @@ function build_extension {
100100
# Make sure the build is up to date
101101
nix run github:huggingface/kernel-builder#update-build -- build.toml
102102

103-
# only do the following if flake.lock exists
104-
105-
# if the lock file exists
103+
# Determine override from flake.nix only
106104
override=""
107-
if [ -f flake.lock ]; then
108-
# check the type of kernel-builder in flake.lock
109-
kernel_url_type=$(cat flake.lock | jq -r '.nodes["kernel-builder"].locked.type')
110-
echo "Kernel URL type: $kernel_url_type"
111-
112-
# If the type is "path", compute the nar hash and set override
113-
if [ "$kernel_url_type" = "path" ]; then
114-
kernel_url_path=$(cat flake.lock | jq -r '.nodes["kernel-builder"].locked.path')
115-
nar_hash=$(nix-hash --type sha256 --base64 "$kernel_url_path")
116-
override="--override-input kernel-builder path:../..?narHash=sha256-$nar_hash"
117-
fi
105+
# check if using a local path for kernel-builder
106+
is_using_path=$(grep -q 'kernel-builder.url *= *"path:' flake.nix && echo "yes" || echo "no")
107+
if [ "$is_using_path" = "yes" ]; then
108+
override="--override-input kernel-builder github:huggingface/kernel-builder"
109+
echo "Detected local path for kernel-builder in flake.nix, overriding to use GitHub source."
110+
else
111+
echo "No local path for kernel-builder detected in flake.nix."
118112
fi
119113

120114
echo "Building with Nix..."

dockerfiles/Dockerfile.user

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM nixos/nix:2.18.8
1+
FROM nixos/nix:2.30.3
22

33
# default build args
44
ARG MAX_JOBS=1
@@ -120,6 +120,17 @@ function build_extension {
120120
# Make sure the build is up to date
121121
nix run github:huggingface/kernel-builder#update-build -- build.toml
122122

123+
# Determine override from flake.nix only
124+
override=""
125+
# check if using a local path for kernel-builder
126+
is_using_path=$(grep -q 'kernel-builder.url *= *"path:' flake.nix && echo "yes" || echo "no")
127+
if [ "$is_using_path" = "yes" ]; then
128+
override="--override-input kernel-builder github:huggingface/kernel-builder"
129+
echo "Detected local path for kernel-builder in flake.nix, overriding to use GitHub source."
130+
else
131+
echo "No local path for kernel-builder detected in flake.nix."
132+
fi
133+
123134
# Pure bundle build
124135
# TODO: remove the "bundle" after resolving
125136
echo "Building with Nix..."

0 commit comments

Comments
 (0)