Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ We also provide Docker containers for CI builds. For a quick build:
# Using the prebuilt container
cd examples/activation
docker run --rm \
-v $(pwd):/app \
-w /app \
ghcr.io/huggingface/kernel-builder:{SHA} \
build
--mount type=bind,source=$(pwd),target=/kernelcode \
-w /kernelcode ghcr.io/huggingface/kernel-builder:main build
```

See [dockerfiles/README.md](./dockerfiles/README.md) for more options, including a user-level container for CI/CD environments.
Expand Down
24 changes: 9 additions & 15 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nixos/nix:2.18.8
FROM nixos/nix:2.30.3

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

# only do the following if flake.lock exists

# if the lock file exists
# Determine override from flake.nix only
override=""
if [ -f flake.lock ]; then
# check the type of kernel-builder in flake.lock
kernel_url_type=$(cat flake.lock | jq -r '.nodes["kernel-builder"].locked.type')
echo "Kernel URL type: $kernel_url_type"

# If the type is "path", compute the nar hash and set override
if [ "$kernel_url_type" = "path" ]; then
kernel_url_path=$(cat flake.lock | jq -r '.nodes["kernel-builder"].locked.path')
nar_hash=$(nix-hash --type sha256 --base64 "$kernel_url_path")
override="--override-input kernel-builder path:../..?narHash=sha256-$nar_hash"
fi
# check if using a local path for kernel-builder
is_using_path=$(grep -q 'kernel-builder.url *= *"path:' flake.nix && echo "yes" || echo "no")
if [ "$is_using_path" = "yes" ]; then
override="--override-input kernel-builder github:huggingface/kernel-builder"
echo "Detected local path for kernel-builder in flake.nix, overriding to use GitHub source."
else
echo "No local path for kernel-builder detected in flake.nix."
fi

echo "Building with Nix..."
Expand Down
13 changes: 12 additions & 1 deletion dockerfiles/Dockerfile.user
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nixos/nix:2.18.8
FROM nixos/nix:2.30.3

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

# Determine override from flake.nix only
override=""
# check if using a local path for kernel-builder
is_using_path=$(grep -q 'kernel-builder.url *= *"path:' flake.nix && echo "yes" || echo "no")
if [ "$is_using_path" = "yes" ]; then
override="--override-input kernel-builder github:huggingface/kernel-builder"
echo "Detected local path for kernel-builder in flake.nix, overriding to use GitHub source."
else
echo "No local path for kernel-builder detected in flake.nix."
fi

# Pure bundle build
# TODO: remove the "bundle" after resolving
echo "Building with Nix..."
Expand Down
Loading