From 92f81802d5ee6432a47ff19001ac97ced7b54b4e Mon Sep 17 00:00:00 2001 From: quantenzitrone Date: Sat, 17 Jan 2026 04:04:43 +0100 Subject: [PATCH] build2: move to pkgs/by-name, also move bootstrap to separate package This triggers 1 "rebuild", however this is not really a rebuild. This commit just moves `build2.passthru.bootstrap` to `build2-bootstrap`, which is seen as a new package. It is already build since it's a dependency of `build2`. in conclusion this doesn't create any rebuilds --- .../nix-ldflags-sysdirs.patch | 0 .../bu/build2-bootstrap/package.nix} | 26 +++++++++- .../bu/build2-bootstrap}/setup-hook.sh | 0 .../bu/build2/package.nix} | 48 ++++++++----------- .../build2/remove-config-store-paths.patch | 0 pkgs/top-level/all-packages.nix | 5 -- 6 files changed, 43 insertions(+), 36 deletions(-) rename pkgs/{development/tools/build-managers/build2 => by-name/bu/build2-bootstrap}/nix-ldflags-sysdirs.patch (100%) rename pkgs/{development/tools/build-managers/build2/bootstrap.nix => by-name/bu/build2-bootstrap/package.nix} (65%) rename pkgs/{development/tools/build-managers/build2 => by-name/bu/build2-bootstrap}/setup-hook.sh (100%) rename pkgs/{development/tools/build-managers/build2/default.nix => by-name/bu/build2/package.nix} (76%) rename pkgs/{development/tools/build-managers => by-name/bu}/build2/remove-config-store-paths.patch (100%) diff --git a/pkgs/development/tools/build-managers/build2/nix-ldflags-sysdirs.patch b/pkgs/by-name/bu/build2-bootstrap/nix-ldflags-sysdirs.patch similarity index 100% rename from pkgs/development/tools/build-managers/build2/nix-ldflags-sysdirs.patch rename to pkgs/by-name/bu/build2-bootstrap/nix-ldflags-sysdirs.patch diff --git a/pkgs/development/tools/build-managers/build2/bootstrap.nix b/pkgs/by-name/bu/build2-bootstrap/package.nix similarity index 65% rename from pkgs/development/tools/build-managers/build2/bootstrap.nix rename to pkgs/by-name/bu/build2-bootstrap/package.nix index 6ef211423641..5c5c4098e65e 100644 --- a/pkgs/development/tools/build-managers/build2/bootstrap.nix +++ b/pkgs/by-name/bu/build2-bootstrap/package.nix @@ -2,7 +2,6 @@ lib, stdenv, fetchurl, - pkgs, buildPackages, fixDarwinDylibNames, }: @@ -52,5 +51,28 @@ stdenv.mkDerivation rec { --subst-var-by isTargetDarwin '${toString stdenv.targetPlatform.isDarwin}' ''; - inherit (pkgs.build2) passthru; + passthru = { + configSharedStatic = + enableShared: enableStatic: + if enableShared && enableStatic then + "both" + else if enableShared then + "shared" + else if enableStatic then + "static" + else + throw "neither shared nor static libraries requested"; + }; + + meta = { + homepage = "https://www.build2.org/"; + description = "Bootstrap for the 'build2' package, you most likely want to use that one"; + license = lib.licenses.mit; + changelog = "https://git.build2.org/cgit/build2/tree/NEWS"; + platforms = lib.platforms.all; + maintainers = with lib.maintainers; [ + hiro98 + r-burns + ]; + }; } diff --git a/pkgs/development/tools/build-managers/build2/setup-hook.sh b/pkgs/by-name/bu/build2-bootstrap/setup-hook.sh similarity index 100% rename from pkgs/development/tools/build-managers/build2/setup-hook.sh rename to pkgs/by-name/bu/build2-bootstrap/setup-hook.sh diff --git a/pkgs/development/tools/build-managers/build2/default.nix b/pkgs/by-name/bu/build2/package.nix similarity index 76% rename from pkgs/development/tools/build-managers/build2/default.nix rename to pkgs/by-name/bu/build2/package.nix index e8f21f173ebb..8c0391dc4f75 100644 --- a/pkgs/development/tools/build-managers/build2/default.nix +++ b/pkgs/by-name/bu/build2/package.nix @@ -1,7 +1,8 @@ { stdenv, lib, - build2, + # Break cycle by using self-contained toolchain for bootstrapping + build2-bootstrap, fetchurl, fixDarwinDylibNames, libbutl, @@ -11,18 +12,9 @@ enableStatic ? !enableShared, }: let - configSharedStatic = - enableShared: enableStatic: - if enableShared && enableStatic then - "both" - else if enableShared then - "shared" - else if enableStatic then - "static" - else - throw "neither shared nor static libraries requested"; + inherit (build2-bootstrap.passthru) configSharedStatic; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "build2"; version = "0.17.0"; @@ -33,26 +25,25 @@ stdenv.mkDerivation rec { "man" ]; - setupHook = ./setup-hook.sh; + setupHook = build2-bootstrap.setupHook; src = fetchurl { - url = "https://pkg.cppget.org/1/alpha/build2/build2-${version}.tar.gz"; + url = "https://pkg.cppget.org/1/alpha/build2/build2-${finalAttrs.version}.tar.gz"; hash = "sha256-Kx5X/GV3GjFSbjo1mzteiHnnm4mr6+NAKIR/mEE+IdA="; }; patches = [ # Remove any build/host config entries which refer to nix store paths ./remove-config-store-paths.patch - # Pick up sysdirs from NIX_LDFLAGS - ./nix-ldflags-sysdirs.patch - ]; + ] + ++ build2-bootstrap.patches; strictDeps = true; nativeBuildInputs = [ - build2 + build2-bootstrap ]; disallowedReferences = [ - build2 + build2-bootstrap libbutl.dev libpkgconf.dev ]; @@ -94,14 +85,19 @@ stdenv.mkDerivation rec { ''; passthru = { - bootstrap = build2; + bootstrap = build2-bootstrap; inherit configSharedStatic; }; meta = { - homepage = "https://www.build2.org/"; + inherit (build2-bootstrap.meta) + homepage + license + changelog + platforms + maintainers + ; description = "Build2 build system"; - license = lib.licenses.mit; longDescription = '' build2 is an open source (MIT), cross-platform build toolchain that aims to approximate Rust Cargo's convenience for developing @@ -114,12 +110,6 @@ stdenv.mkDerivation rec { at C/C++ projects as well as mixed-language projects involving one of these languages (see bash and rust modules, for example). ''; - changelog = "https://git.build2.org/cgit/build2/tree/NEWS"; - platforms = lib.platforms.all; - maintainers = with lib.maintainers; [ - hiro98 - r-burns - ]; mainProgram = "b"; }; -} +}) diff --git a/pkgs/development/tools/build-managers/build2/remove-config-store-paths.patch b/pkgs/by-name/bu/build2/remove-config-store-paths.patch similarity index 100% rename from pkgs/development/tools/build-managers/build2/remove-config-store-paths.patch rename to pkgs/by-name/bu/build2/remove-config-store-paths.patch diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ae4b00cdb1d3..85265ba6cb1b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5934,11 +5934,6 @@ with pkgs; black-macchiato = with python3Packages; toPythonApplication black-macchiato; - build2 = callPackage ../development/tools/build-managers/build2 { - # Break cycle by using self-contained toolchain for bootstrapping - build2 = buildPackages.callPackage ../development/tools/build-managers/build2/bootstrap.nix { }; - }; - # Dependency of build2, must also break cycle for this libbutl = callPackage ../development/libraries/libbutl { build2 = build2.bootstrap;