Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/numtide/bld
Build nix targets based on git repository directories
https://github.com/numtide/bld
buildbot-numtide monorepo nix
Last synced: about 2 months ago
JSON representation
Build nix targets based on git repository directories
- Host: GitHub
- URL: https://github.com/numtide/bld
- Owner: numtide
- Created: 2022-09-06T22:08:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-23T10:04:13.000Z (10 months ago)
- Last Synced: 2024-04-19T19:06:41.730Z (8 months ago)
- Topics: buildbot-numtide, monorepo, nix
- Language: Go
- Homepage:
- Size: 67.4 KB
- Stars: 28
- Watchers: 8
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bld
bld is an experimental build tool for monorepos inspired by Bazel, and
implemented with Nix. This is meant to evolve and its current form is not the
final one.This tool has two sides: a CLI and a Nix library, that are meant to be able to
work together.## Principles
We steal the notion of "targets" from Bazel, making each folder open-ended.
It should be possible to type `bld` in any folder and get the build output of
the current folder (and below?).It should be possible to build any targets using purely `nix-build`.
## Usage
`$ bld --help`
```
Usage: bldFlags:
-h, --help Show context-sensitive help.
--debugCommands:
build []
Build targetlist []
List available targetsrun []
Run executable targetinspect []
Show build information about targetRun "bld --help" for more information on a command.
```The following examples are from this repository.
To list all targets.
`$ bld list`
```A
bin
default
devShell
hello
```To build a target.
`$ bld build hello`
```
INFO[0000] Building target target=hello
/nix/store/9a74wmrh6l9h012xza53ff58v0rx456d-hello
```To run a target.
`$ bld run hello`
```
/nix/store/9a74wmrh6l9h012xza53ff58v0rx456d-hello
Hello, world!
```This can be also used to pass flags:
`$ bld run hello -- --help`
```
/nix/store/9a74wmrh6l9h012xza53ff58v0rx456d-hello
Print a friendly, customizable greeting.-t, --traditional use traditional greeting
-g, --greeting=TEXT use TEXT as the greeting message--help display this help and exit
--version output version information and exitReport bugs to: [email protected]
GNU Hello home page:
General help using GNU software:
```To inspect a target.
`$ bld inspect hello`
```
{
"/nix/store/bn6wpa9yqibcy83d2iabh1s5k49lcpb7-hello.drv": {
"args": [
"-e",
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"
],
"builder": "/nix/store/1b9p07z77phvv2hf6gm9f28syp39f1ag-bash-5.1-p16/bin/bash",
"env": {
"allowSubstitutes": "",
"buildCommand": "target=$out'/bin/hello'\nmkdir -p \"$(dirname \"$target\")\"\n\nif [ -e \"$textPath\" ]; then\n mv \"$textPath\" \"$target\"\nelse\n echo -n \"$text\" > \"$target\"\nfi\n\neval \"$checkPhase\"\n\n(test -n \"$executable\" && chmod +x \"$target\") || true\n",
"buildInputs": "",
"builder": "/nix/store/1b9p07z77phvv2hf6gm9f28syp39f1ag-bash-5.1-p16/bin/bash",
"checkPhase": "/nix/store/1b9p07z77phvv2hf6gm9f28syp39f1ag-bash-5.1-p16/bin/bash -n -O extglob \"$target\"\n",
"cmakeFlags": "",
"configureFlags": "",
"depsBuildBuild": "",
"depsBuildBuildPropagated": "",
"depsBuildTarget": "",
"depsBuildTargetPropagated": "",
"depsHostHost": "",
"depsHostHostPropagated": "",
"depsTargetTarget": "",
"depsTargetTargetPropagated": "",
"doCheck": "",
"doInstallCheck": "",
"enableParallelBuilding": "1",
"enableParallelChecking": "1",
"executable": "1",
"mesonFlags": "",
"name": "hello",
"nativeBuildInputs": "",
"out": "/nix/store/9a74wmrh6l9h012xza53ff58v0rx456d-hello",
"outputs": "out",
"passAsFile": "buildCommand text",
"patches": "",
"preferLocalBuild": "1",
"propagatedBuildInputs": "",
"propagatedNativeBuildInputs": "",
"stdenv": "/nix/store/p93ivxvrf3c2w02la2c6nppmkgdh08y3-stdenv-linux",
"strictDeps": "",
"system": "x86_64-linux",
"text": "#!/nix/store/1b9p07z77phvv2hf6gm9f28syp39f1ag-bash-5.1-p16/bin/bash\n/nix/store/y4mxrg8c6l09lb2szl69vwl4f6441i5k-hello-2.12.1/bin/hello\n\n"
},
"inputDrvs": {
"/nix/store/6pj63b323pn53gpw3l5kdh1rly55aj15-bash-5.1-p16.drv": [
"out"
],
"/nix/store/g6qkwa2xaq6i40cwl9bpjxi19m7q8121-hello-2.12.1.drv": [
"out"
],
"/nix/store/zq638s1j77mxzc52ql21l9ncl3qsjb2h-stdenv-linux.drv": [
"out"
]
},
"inputSrcs": [
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"
],
"outputs": {
"out": {
"path": "/nix/store/9a74wmrh6l9h012xza53ff58v0rx456d-hello"
}
},
"system": "x86_64-linux"
}
}
```## Future ideas
* Resolve the targets purely with Nix. It should be necessary to connect the
BUILD.nix files manually like currently.
* Snapshot nixpkgs. In order to speed-up nixpkgs, we want to be able to
snapshot the build outputs that we are going to use.
* Add nix evaluation caching to speed-up builds.
* Introduce incremental rebuild Nix libraries for various languages.
* Hook in pre-processing tools. It should be possible to update a third-party
package hash automatically.