Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1f92be1
Add build workflow
zombiezen Aug 2, 2026
04ad58f
Fix commit hash reference
zombiezen Aug 3, 2026
d9a2622
Update to fixed version of setup-zb
zombiezen Aug 3, 2026
86c2aee
Update to latest setup-zb commit
zombiezen Aug 3, 2026
0c65ee1
Update to latest setup-zb to fix install options
zombiezen Aug 3, 2026
7e3d3b6
Update to latest setup-zb commit
zombiezen Aug 3, 2026
9be1b5c
Update to latest setup-zb commit
zombiezen Aug 3, 2026
1a84389
Update to latest setup-zb commit
zombiezen Aug 3, 2026
29bb2cf
Update to latest setup-zb commit
zombiezen Aug 3, 2026
8d5a3dc
Update to latest setup-zb commit
zombiezen Aug 3, 2026
92a027e
Build gcc
zombiezen Aug 3, 2026
e673034
Use setup-zb@v1
zombiezen Aug 3, 2026
498361f
Add remote store configuration
zombiezen Aug 5, 2026
3e42635
Enable debug logging
zombiezen Aug 5, 2026
c720773
Disable debug logging
zombiezen Aug 6, 2026
dbc3318
Authenticate to Google Cloud Platform
zombiezen Aug 6, 2026
addc34f
Set project ID
zombiezen Aug 6, 2026
1eb1c36
Remove unnecessary project ID input
zombiezen Aug 6, 2026
7478d31
Add project ID input back
zombiezen Aug 6, 2026
990ddb1
Update to beta4
zombiezen Aug 7, 2026
f5fc856
Update to beta5
zombiezen Aug 11, 2026
f9e4495
Use `__outputs` metafield
zombiezen Aug 16, 2026
55c6658
Use new built-in `defaultOutput` function
zombiezen Aug 17, 2026
a0f581e
Add CI file to run tests
zombiezen Aug 17, 2026
c14988d
Create zb cache directory
zombiezen Aug 18, 2026
70784a5
Disable debug logs on client
zombiezen Aug 18, 2026
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
71 changes: 71 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Copyright 2026 The zb Authors
# SPDX-License-Identifier: MIT

name: Build
on:
push:
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
env:
my_zb_version: '0.2.0-beta6'
my_zb_config: >-
{
"debug": true,
"trustedPublicKeys": [
{"format":"ed25519","publicKey":"M0Wc4njJwCmAHZSp06CE1iNYVXvw023OZqgf0iPMBVA="},
],
"server": {
"download": {
"type": "http",
"url": "https://zb-cache.256lights.llc/store.json",
},
},
}
steps:
- uses: actions/checkout@v7
- uses: google-github-actions/auth@v3
if: github.event_name == 'push'
with:
project_id: ${{ vars.ZB_WORKLOAD_IDENTITY_PROVIDER }}
workload_identity_provider: ${{ vars.ZB_WORKLOAD_IDENTITY_PROVIDER }}
- run: mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/zb"
- uses: 256lights/setup-zb@v1
if: github.event_name != 'push'
with:
zb-version: ${{ env.my_zb_version }}
configuration: ${{ env.my_zb_config }}
- name: Set up zb with upload settings
if: github.event_name == 'push'
uses: 256lights/setup-zb@v1
with:
zb-version: ${{ env.my_zb_version }}
configuration: ${{ env.my_zb_config }}
signing-key: ${{ secrets.ZB_SIGNING_KEY }}
server-upload-discovery: >-
{
"_links": {
"https://zb-build.dev/api/rel/narinfo": [
{
"href": "gs://zb-stdlib-cache/{digest}.narinfo",
"templated": true
}
],
"https://zb-build.dev/api/rel/nar": {
"href": "gs://zb-stdlib-cache/nar/{digest}.nar",
"templated": true
},
"https://zb-build.dev/api/rel/realization": [
{
"href": "gs://zb-stdlib-cache/realizations/{hashDigest}.json",
"templated": true
}
]
}
}
- run: zb build --debug=0 ci.lua
11 changes: 5 additions & 6 deletions bootstrap/binary/linux.lua
Original file line number Diff line number Diff line change
Expand Up @@ -240,19 +240,18 @@ find \
return makeDerivation(args)
end

local linuxHeaders <const> = linuxHeaders.new {
local linuxHeaders <const> = defaultOutput(linuxHeaders.new {
makeDerivation = makeDerivationWithGCC2;
buildSystem = system;
targetSystem = system;
version = "4.14.336";
}
}, system)

local busybox = busybox.new {
local busybox = defaultOutput(busybox.new {
makeDerivation = makeDerivationWithGCC2;
buildSystem = system;
version = "1.36.1";
configFile = path "busybox-config";
linuxHeaders = linuxHeaders;
}
}, system)

return {
gcc = gcc2;
Expand Down
11 changes: 11 additions & 0 deletions ci.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Copyright 2026 The zb Authors
-- SPDX-License-Identifier: MIT

return {
stdenv = import("stdenv/stdenv.lua").makeDerivation {
name = "stdenv-test";
dontUnpack = true;
installPhase = "touch $out";
};
go = import("packages/go/go.lua")["1.26"];
}
174 changes: 86 additions & 88 deletions packages/bash/bash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ local strings <const> = import "../../strings.lua"
local systems <const> = import "../../systems.lua"
local tables <const> = import "../../tables.lua"

local module <const> = {}
local getters <const> = {}
local module <const> = setmetatable({}, { __index = tables.lazyModule(getters) })

local tarballArgs <const> = {
["5.2.15"] = {
Expand All @@ -24,104 +25,101 @@ local patches <const> = {
path "patches/5.2.15/02-omit-rdynamic.diff",
}

---@generic T
---@param args {
---makeDerivation: function,
---buildSystem: string,
---makeDerivation: (fun(args: table<string, any>): T),
---version: string,
---}
---@return derivation
---@return T
function module.new(args)
local src = module.tarballs[args.version]
if not src then
error("bash.new: unsupported version "..args.version)
end
local buildSystem = systems.parse(args.buildSystem)
local configureFlags = {
"--without-bash-malloc",
"--disable-nls",
}
if buildSystem.isLinux then
configureFlags[#configureFlags+1] = "--enable-static-link"
end
return args.makeDerivation {
pname = "bash";
version = args.version;
buildSystem = args.buildSystem;
src = src;
patches = patches;
postInstall = [[ln -s bash "$out/bin/sh"]];

configureFlags = configureFlags;
}
return tables.withOutputs(args, function(args, system)
local buildSystem = systems.parse(system)
local configureFlags = {
"--without-bash-malloc",
"--disable-nls",
}
if buildSystem.isLinux then
configureFlags[#configureFlags + 1] = "--enable-static-link"
end
return outputs(args.makeDerivation {
pname = "bash";
version = args.version;
src = src;
patches = patches;
postInstall = [[ln -s bash "$out/bin/sh"]];

configureFlags = configureFlags;
}, system)
end)
end

for _, system in ipairs(systems.stdlibSystems) do
local system <const> = system
module[system] = tables.lazyModule {
bootstrap = function()
local version <const> = "5.2.15"

local sys <const> = systems.parse(system)
if sys and sys.isLinux then
local seeds <const> = import "../../bootstrap/seeds.lua"
return derivation {
name = "bash-"..version;
pname = "bash";
version = version;

system = system;
builder = seeds[system].busybox.."/bin/sh";
args = { path "build.sh" };

src = module.tarballs[version];
patches = patches;

PATH = strings.makeBinPath {
gnumake[system].bootstrap,
seeds[system].busybox,
gcc[system].bootstrap,
};
LDFLAGS = { "-static" };
SOURCE_DATE_EPOCH = 0;
KBUILD_BUILD_TIMESTAMP = "@0";
}
elseif sys and sys.isMacOS then
return derivation {
name = "bash-"..version;
pname = "bash";
version = version;

system = system;
builder = "/bin/sh";
args = { path "build.sh" };

src = module.tarballs[version];
patches = patches;

PATH = strings.makeBinPath {
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr",
"/Library/Developer/CommandLineTools/usr",
"/usr",
"/",
};
__buildSystemDeps = { "/usr", "/bin", "/Library/Developer/CommandLineTools" };
SOURCE_DATE_EPOCH = 0;
KBUILD_BUILD_TIMESTAMP = "@0";
}
else
return nil
end
end;

stdenv = function()
local stdenv <const> = import "../../stdenv/stdenv.lua"
return module.new {
makeDerivation = stdenv.makeBootstrapDerivation;
buildSystem = system;
version = "5.2.15";
}
end;
function getters.stdenv()
local stdenv <const> = import "../../stdenv/stdenv.lua"
return module.new {
makeDerivation = stdenv.makeBootstrapDerivation;
version = "5.2.15";
}
end

function getters.bootstrap()
local version <const> = "5.2.15"

return tables.withOutputs({ version = version }, function(_self, system)
local sys <const> = systems.parse(system)
if sys and sys.isLinux then
local seeds <const> = import "../../bootstrap/seeds.lua"
return outputs(derivation {
name = "bash-"..version;
pname = "bash";
version = version;

system = system;
builder = defaultOutput(seeds[system].busybox, system).."/bin/sh";
args = { path "build.sh" };

src = module.tarballs[version];
patches = patches;

PATH = strings.makeBinPath(system, {
gnumake.bootstrap,
seeds[system].busybox,
gcc.bootstrap,
});
LDFLAGS = { "-static" };
SOURCE_DATE_EPOCH = 0;
KBUILD_BUILD_TIMESTAMP = "@0";
}, system)
elseif sys and sys.isMacOS then
return outputs(derivation {
name = "bash-"..version;
pname = "bash";
version = version;

system = system;
builder = "/bin/sh";
args = { path "build.sh" };

src = module.tarballs[version];
patches = patches;

PATH = strings.makeBinPath(system, {
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr",
"/Library/Developer/CommandLineTools/usr",
"/usr",
"/",
});
__buildSystemDeps = { "/usr", "/bin", "/Library/Developer/CommandLineTools" };
SOURCE_DATE_EPOCH = 0;
KBUILD_BUILD_TIMESTAMP = "@0";
}, system)
else
error("bash.bootstrap: unsupported system "..system)
end
end)
end

return module
37 changes: 21 additions & 16 deletions packages/busybox/busybox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,39 @@ local patches <const> = {

---@param args {
---makeDerivation: (fun(args: table<string, any>): derivation),
---buildSystem: string,
---version: string,
---configFile: derivation|string,
---linuxHeaders: derivation|string,
---configFile: any,
---linuxHeaders: any,
---}
---@return derivation
function module.new(args)
local src = module.tarballs[args.version]
if not src then
error("busybox.new: unsupported version "..args.version)
end
return args.makeDerivation {
return tables.withOutputs({
pname = "busybox";
version = args.version;
buildSystem = args.buildSystem;
src = src;
patches = patches[args.version];

CONFIG_INSTALL_NO_USR = "y";
configFile = args.configFile;
configurePhase = "cp $configFile .config";

C_INCLUDE_PATH = strings.makeIncludePath {
args.linuxHeaders
};

installPhase = [[make CONFIG_PREFIX="$out" ${makeFlags:-} ${installFlags:-} install]];
}
}, function(self, system)
return args.makeDerivation {
pname = self.pname;
version = self.version;
src = self.src;
patches = self.patches;

CONFIG_INSTALL_NO_USR = "y";
configFile = defaultOutput(args.configFile, system);
configurePhase = "cp $configFile .config";

C_INCLUDE_PATH = strings.makeIncludePath(system, {
defaultOutput(args.linuxHeaders, system),
});

installPhase = [[make CONFIG_PREFIX="$out" ${makeFlags:-} ${installFlags:-} install]];
}
end)
end

return module
Loading
Loading