{"id":18465576,"url":"https://github.com/numtide/bld","last_synced_at":"2025-04-08T08:31:55.268Z","repository":{"id":65057595,"uuid":"533516395","full_name":"numtide/bld","owner":"numtide","description":"Build nix targets based on git repository directories","archived":true,"fork":false,"pushed_at":"2025-03-31T10:48:17.000Z","size":71,"stargazers_count":28,"open_issues_count":2,"forks_count":0,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-31T11:33:23.658Z","etag":null,"topics":["buildbot-numtide","monorepo","nix"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/numtide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-06T22:08:15.000Z","updated_at":"2025-03-31T10:48:35.000Z","dependencies_parsed_at":"2023-12-31T14:25:51.591Z","dependency_job_id":"20c6359d-0835-467d-bf5b-5ba05342c418","html_url":"https://github.com/numtide/bld","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fbld","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fbld/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fbld/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fbld/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numtide","download_url":"https://codeload.github.com/numtide/bld/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247804590,"owners_count":20999017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["buildbot-numtide","monorepo","nix"],"created_at":"2024-11-06T09:13:35.147Z","updated_at":"2025-04-08T08:31:55.262Z","avatar_url":"https://github.com/numtide.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bld\n\n**The experiment is over for now. For most use-cases, something like [blueprint](https://github.com/numtide/blueprint) is good enough.**\n\nbld is an experimental build tool for monorepos inspired by Bazel, and \nimplemented with Nix. This is meant to evolve and its current form is not the\nfinal one.\n\nThis tool has two sides: a CLI and a Nix library, that are meant to be able to\nwork together.\n\n## Principles\n\nWe steal the notion of \"targets\" from Bazel, making each folder open-ended.\n\nIt should be possible to type `bld` in any folder and get the build output of\nthe current folder (and below?).\n\nIt should be possible to build any targets using purely `nix-build`.\n\n## Usage\n\n`$ bld --help`\n```\nUsage: bld \u003ccommand\u003e\n\nFlags:\n  -h, --help     Show context-sensitive help.\n      --debug\n\nCommands:\n  build [\u003ctarget\u003e]\n    Build target\n\n  list [\u003ctarget\u003e]\n    List available targets\n\n  run [\u003ctarget\u003e]\n    Run executable target\n\n  inspect [\u003ctarget\u003e]\n    Show build information about target\n\nRun \"bld \u003ccommand\u003e --help\" for more information on a command.\n```\n\nThe following examples are from this repository.\n\n\n\u003cdetails\u003e\n\u003csummary\u003eTo list all targets.\u003c/summary\u003e\n\n`$ bld list`\n```A\nbin\ndefault\ndevShell\nhello\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eTo build a target.\u003c/summary\u003e\n\n`$ bld build hello`\n```\nINFO[0000] Building target                               target=hello\n/nix/store/9a74wmrh6l9h012xza53ff58v0rx456d-hello\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eTo run a target.\u003c/summary\u003e\n\n`$ bld run hello`\n```\n/nix/store/9a74wmrh6l9h012xza53ff58v0rx456d-hello\nHello, world!\n```\n\nThis can be also used to pass flags:\n\n`$ bld run hello -- --help`\n```\n/nix/store/9a74wmrh6l9h012xza53ff58v0rx456d-hello\nPrint a friendly, customizable greeting.\n\n  -t, --traditional       use traditional greeting\n  -g, --greeting=TEXT     use TEXT as the greeting message\n\n      --help     display this help and exit\n      --version  output version information and exit\n\nReport bugs to: bug-hello@gnu.org\nGNU Hello home page: \u003chttps://www.gnu.org/software/hello/\u003e\nGeneral help using GNU software: \u003chttps://www.gnu.org/gethelp/\u003e\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eTo inspect a target.\u003c/summary\u003e\n\n`$ bld inspect hello`\n```\n{\n  \"/nix/store/bn6wpa9yqibcy83d2iabh1s5k49lcpb7-hello.drv\": {\n    \"args\": [\n      \"-e\",\n      \"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh\"\n    ],\n    \"builder\": \"/nix/store/1b9p07z77phvv2hf6gm9f28syp39f1ag-bash-5.1-p16/bin/bash\",\n    \"env\": {\n      \"allowSubstitutes\": \"\",\n      \"buildCommand\": \"target=$out'/bin/hello'\\nmkdir -p \\\"$(dirname \\\"$target\\\")\\\"\\n\\nif [ -e \\\"$textPath\\\" ]; then\\n  mv \\\"$textPath\\\" \\\"$target\\\"\\nelse\\n  echo -n \\\"$text\\\" \u003e \\\"$target\\\"\\nfi\\n\\neval \\\"$checkPhase\\\"\\n\\n(test -n \\\"$executable\\\" \u0026\u0026 chmod +x \\\"$target\\\") || true\\n\",\n      \"buildInputs\": \"\",\n      \"builder\": \"/nix/store/1b9p07z77phvv2hf6gm9f28syp39f1ag-bash-5.1-p16/bin/bash\",\n      \"checkPhase\": \"/nix/store/1b9p07z77phvv2hf6gm9f28syp39f1ag-bash-5.1-p16/bin/bash -n -O extglob \\\"$target\\\"\\n\",\n      \"cmakeFlags\": \"\",\n      \"configureFlags\": \"\",\n      \"depsBuildBuild\": \"\",\n      \"depsBuildBuildPropagated\": \"\",\n      \"depsBuildTarget\": \"\",\n      \"depsBuildTargetPropagated\": \"\",\n      \"depsHostHost\": \"\",\n      \"depsHostHostPropagated\": \"\",\n      \"depsTargetTarget\": \"\",\n      \"depsTargetTargetPropagated\": \"\",\n      \"doCheck\": \"\",\n      \"doInstallCheck\": \"\",\n      \"enableParallelBuilding\": \"1\",\n      \"enableParallelChecking\": \"1\",\n      \"executable\": \"1\",\n      \"mesonFlags\": \"\",\n      \"name\": \"hello\",\n      \"nativeBuildInputs\": \"\",\n      \"out\": \"/nix/store/9a74wmrh6l9h012xza53ff58v0rx456d-hello\",\n      \"outputs\": \"out\",\n      \"passAsFile\": \"buildCommand text\",\n      \"patches\": \"\",\n      \"preferLocalBuild\": \"1\",\n      \"propagatedBuildInputs\": \"\",\n      \"propagatedNativeBuildInputs\": \"\",\n      \"stdenv\": \"/nix/store/p93ivxvrf3c2w02la2c6nppmkgdh08y3-stdenv-linux\",\n      \"strictDeps\": \"\",\n      \"system\": \"x86_64-linux\",\n      \"text\": \"#!/nix/store/1b9p07z77phvv2hf6gm9f28syp39f1ag-bash-5.1-p16/bin/bash\\n/nix/store/y4mxrg8c6l09lb2szl69vwl4f6441i5k-hello-2.12.1/bin/hello\\n\\n\"\n    },\n    \"inputDrvs\": {\n      \"/nix/store/6pj63b323pn53gpw3l5kdh1rly55aj15-bash-5.1-p16.drv\": [\n        \"out\"\n      ],\n      \"/nix/store/g6qkwa2xaq6i40cwl9bpjxi19m7q8121-hello-2.12.1.drv\": [\n        \"out\"\n      ],\n      \"/nix/store/zq638s1j77mxzc52ql21l9ncl3qsjb2h-stdenv-linux.drv\": [\n        \"out\"\n      ]\n    },\n    \"inputSrcs\": [\n      \"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh\"\n    ],\n    \"outputs\": {\n      \"out\": {\n        \"path\": \"/nix/store/9a74wmrh6l9h012xza53ff58v0rx456d-hello\"\n      }\n    },\n    \"system\": \"x86_64-linux\"\n  }\n}\n```\n\u003c/details\u003e\n\n\n## Future ideas\n\n* Resolve the targets purely with Nix. It should be necessary to connect the\n  BUILD.nix files manually like currently.\n* Snapshot nixpkgs. In order to speed-up nixpkgs, we want to be able to\n  snapshot the build outputs that we are going to use.\n* Add nix evaluation caching to speed-up builds.\n* Introduce incremental rebuild Nix libraries for various languages.\n* Hook in pre-processing tools. It should be possible to update a third-party\n  package hash automatically.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtide%2Fbld","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumtide%2Fbld","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtide%2Fbld/lists"}