diff --git a/pkgs/tools/package-management/lix/common.nix b/pkgs/tools/package-management/lix/common.nix index 50010e1ae3926ef..ca495d270a1fcc9 100644 --- a/pkgs/tools/package-management/lix/common.nix +++ b/pkgs/tools/package-management/lix/common.nix @@ -19,7 +19,6 @@ assert (hash == null) -> (src != null); { stdenv, meson, - bash, bison, boehmgc, boost, @@ -27,29 +26,20 @@ assert (hash == null) -> (src != null); busybox-sandbox-shell, bzip2, callPackage, - coreutils, curl, cmake, - docbook_xsl_ns, - docbook5, doxygen, editline, flex, git, - gnutar, gtest, - gzip, jq, lib, libarchive, libcpuid, - libgit2, libsodium, - libxml2, - libxslt, lowdown, lsof, - man, mercurial, mdbook, mdbook-linkcheck, @@ -57,8 +47,8 @@ assert (hash == null) -> (src != null); ninja, openssl, toml11, + pegtl, python3, - perl, pkg-config, rapidcheck, Security, @@ -87,6 +77,9 @@ assert (hash == null) -> (src != null); }: assert lib.assertMsg (docCargoHash != null || docCargoLock != null) "Either `lix-doc`'s cargoHash using `docCargoHash` or `lix-doc`'s `cargoLock.lockFile` using `docCargoLock` must be set!"; +let + isLegacyParser = lib.versionOlder version "2.91"; +in stdenv.mkDerivation (finalAttrs: { pname = "lix"; @@ -103,6 +96,7 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optionals enableDocumentation [ "man" "doc" + "devdoc" ]; strictDeps = true; @@ -110,14 +104,12 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ pkg-config - bison flex jq meson ninja cmake python3 - doxygen # Tests git @@ -125,10 +117,12 @@ stdenv.mkDerivation (finalAttrs: { jq lsof ] - ++ lib.optionals (enableDocumentation) [ + ++ lib.optionals isLegacyParser [ bison ] + ++ lib.optionals enableDocumentation [ (lib.getBin lowdown) mdbook mdbook-linkcheck + doxygen ] ++ lib.optionals stdenv.isLinux [ util-linuxMinimal ]; @@ -150,6 +144,7 @@ stdenv.mkDerivation (finalAttrs: { toml11 lix-doc ] + ++ lib.optionals (!isLegacyParser) [ pegtl ] ++ lib.optionals stdenv.isDarwin [ Security ] ++ lib.optionals (stdenv.isx86_64) [ libcpuid ] ++ lib.optionals withLibseccomp [ libseccomp ] @@ -161,7 +156,7 @@ stdenv.mkDerivation (finalAttrs: { ]; postPatch = '' - patchShebangs --build tests + patchShebangs --build tests doc/manual ''; preConfigure = @@ -192,13 +187,20 @@ stdenv.mkDerivation (finalAttrs: { BOOST_LIBRARYDIR = "${lib.getLib boost}/lib"; }; - mesonBuildType = "release"; + # -O3 seems to anger a gcc bug and provide no performance benefit. + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114360 + # We use -O2 upstream https://gerrit.lix.systems/c/lix/+/554 + mesonBuildType = "debugoptimized"; + mesonFlags = [ - # LTO optimization + # Enable LTO, since it improves eval performance a fair amount + # LTO is disabled on static due to strange linking errors + (lib.mesonBool "b_lto" (!stdenv.hostPlatform.isStatic)) (lib.mesonEnable "gc" true) (lib.mesonBool "enable-tests" true) (lib.mesonBool "enable-docs" enableDocumentation) + (lib.mesonEnable "internal-api-docs" enableDocumentation) (lib.mesonBool "enable-embedded-sandbox-shell" (stdenv.isLinux && stdenv.hostPlatform.isStatic)) (lib.mesonEnable "seccomp-sandboxing" withLibseccomp) @@ -210,10 +212,15 @@ stdenv.mkDerivation (finalAttrs: { (lib.mesonOption "sandbox-shell" "${busybox-sandbox-shell}/bin/busybox") ]; + ninjaFlags = [ "-v" ]; + postInstall = - '' + lib.optionalString enableDocumentation '' mkdir -p $doc/nix-support echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products + + mkdir -p $devdoc/nix-support + echo "devdoc internal-api $devdoc/share/doc/nix/internal-api" >> $devdoc/nix-support/hydra-build-products '' + lib.optionalString stdenv.hostPlatform.isStatic '' mkdir -p $out/nix-support @@ -228,15 +235,27 @@ stdenv.mkDerivation (finalAttrs: { done ''; + # This needs to run after _multioutDocs moves the docs to $doc + postFixup = lib.optionalString enableDocumentation '' + mkdir -p $devdoc/share/doc/nix + mv $doc/share/doc/nix/internal-api $devdoc/share/doc/nix + ''; + doCheck = true; - mesonCheckFlags = [ "--suite=check" ]; + mesonCheckFlags = [ + "--suite=check" + "--print-errorlogs" + ]; checkInputs = [ gtest rapidcheck ]; doInstallCheck = true; - mesonInstallCheckFlags = [ "--suite=installcheck" ]; + mesonInstallCheckFlags = [ + "--suite=installcheck" + "--print-errorlogs" + ]; preInstallCheck = lib.optionalString stdenv.hostPlatform.isDarwin '' # socket path becomes too long otherwise @@ -255,12 +274,17 @@ stdenv.mkDerivation (finalAttrs: { hardeningDisable = [ # strictoverflow is disabled because we trap on signed overflow instead "strictoverflow" - ] ++ lib.optional stdenv.hostPlatform.isStatic "pie"; + ] + # fortify breaks the build with lto and musl for some reason + ++ lib.optional stdenv.hostPlatform.isMusl "fortify"; + # hardeningEnable = lib.optionals (!stdenv.isDarwin) [ "pie" ]; - # hardeningDisable = lib.optional stdenv.hostPlatform.isMusl "fortify"; separateDebugInfo = stdenv.isLinux && !enableStatic; enableParallelBuilding = true; + # Used by (1) test which has dynamic port assignment. + __darwinAllowLocalNetworking = true; + passthru = { inherit aws-sdk-cpp boehmgc; tests = { @@ -271,7 +295,7 @@ stdenv.mkDerivation (finalAttrs: { # point 'nix edit' and ofborg at the file that defines the attribute, # not this common file. pos = builtins.unsafeGetAttrPos "version" args; - meta = with lib; { + meta = { description = "Powerful package manager that makes package management reliable and reproducible"; longDescription = '' Lix (a fork of Nix) is a powerful package manager for Linux and other Unix systems that @@ -281,11 +305,10 @@ stdenv.mkDerivation (finalAttrs: { environments. ''; homepage = "https://lix.systems"; - license = licenses.lgpl21Plus; + license = lib.licenses.lgpl21Plus; inherit maintainers; - platforms = platforms.unix; - outputsToInstall = [ "out" ] ++ optional enableDocumentation "man"; + platforms = lib.platforms.unix; + outputsToInstall = [ "out" ] ++ lib.optional enableDocumentation "man"; mainProgram = "nix"; - broken = enableStatic; }; }) diff --git a/pkgs/tools/package-management/lix/default.nix b/pkgs/tools/package-management/lix/default.nix index 40e32f06a29ecc1..6cead94f56179b5 100644 --- a/pkgs/tools/package-management/lix/default.nix +++ b/pkgs/tools/package-management/lix/default.nix @@ -4,6 +4,7 @@ boehmgc, callPackage, fetchFromGitHub, + fetchpatch, Security, storeDir ? "/nix/store", @@ -33,6 +34,9 @@ let requiredSystemFeatures = [ ]; }; + # Since Lix 2.91 does not use boost coroutines, it does not need boehmgc patches either. + needsBoehmgcPatches = version: lib.versionOlder version "2.91"; + common = args: callPackage (import ./common.nix ({ inherit lib fetchFromGitHub; } // args)) { @@ -42,11 +46,11 @@ let stateDir confDir ; - boehmgc = boehmgc-nix; + boehmgc = if needsBoehmgcPatches args.version then boehmgc-nix else boehmgc-nix_2_3; aws-sdk-cpp = aws-sdk-cpp-nix; }; in -lib.makeExtensible (self: ({ +lib.makeExtensible (self: { buildLix = common; lix_2_90 = ( @@ -57,6 +61,31 @@ lib.makeExtensible (self: ({ } ); - latest = self.lix_2_90; - stable = self.lix_2_90; -})) + lix_2_91 = ( + common { + version = "2.91.0"; + hash = "sha256-Rosl9iA9MybF5Bud4BTAQ9adbY81aGmPfV8dDBGl34s="; + docCargoHash = "sha256-KOn1fXF7k7c/0e5ZCNZwt3YZmjL1oi5A2mhwxQWKaUo="; + + patches = [ + # Fix meson to not use target_machine, fixing cross. This commit is in release-2.91: remove when updating to 2.91.1 (if any). + # https://gerrit.lix.systems/c/lix/+/1781 + # https://git.lix.systems/lix-project/lix/commit/ca2b514e20de12b75088b06b8e0e316482516401 + (fetchpatch { + url = "https://git.lix.systems/lix-project/lix/commit/ca2b514e20de12b75088b06b8e0e316482516401.patch"; + hash = "sha256-TZauU4RIsn07xv9vZ33amrDvCLMbrtcHs1ozOTLgu98="; + }) + # Fix musl builds. This commit is in release-2.91: remove when updating to 2.91.1 (if any). + # https://gerrit.lix.systems/c/lix/+/1823 + # https://git.lix.systems/lix-project/lix/commit/ed51a172c69996fc6f3b7dfaa86015bff50c8ba8 + (fetchpatch { + url = "https://git.lix.systems/lix-project/lix/commit/ed51a172c69996fc6f3b7dfaa86015bff50c8ba8.patch"; + hash = "sha256-X59N+tOQ2GN17p9sXvo9OiuEexzB23ieuOvtq2sre5c="; + }) + ]; + } + ); + + latest = self.lix_2_91; + stable = self.lix_2_91; +})