`lixPackageSets.lix_2_92`: init (#393444)

authored by jade and committed by GitHub fd5897d3 3e05a0d6

+142 -13
+5
nixos/tests/installer.nix
··· 638 638 clevisTest ? false, 639 639 clevisFallbackTest ? false, 640 640 disableFileSystems ? false, 641 + selectNixPackage ? pkgs: pkgs.nixStable, 641 642 }: 642 643 let 643 644 isEfi = bootLoader == "systemd-boot" || (bootLoader == "grub" && grubUseEfi); ··· 701 702 virtualisation.rootDevice = "/dev/vdb"; 702 703 703 704 hardware.enableAllFirmware = mkForce false; 705 + nix.package = selectNixPackage pkgs; 704 706 705 707 # The test cannot access the network, so any packages we 706 708 # need must be included in the VM. ··· 1101 1103 # The (almost) simplest partitioning scheme: a swap partition and 1102 1104 # one big filesystem partition. 1103 1105 simple = makeInstallerTest "simple" simple-test-config; 1106 + lix-simple = makeInstallerTest "simple" simple-test-config // { 1107 + selectNixPackage = pkgs: pkgs.lix; 1108 + }; 1104 1109 1105 1110 switchToFlake = makeInstallerTest "switch-to-flake" simple-test-config-flake; 1106 1111
+82 -7
pkgs/tools/package-management/lix/common-lix.nix
··· 3 3 suffix ? "", 4 4 version, 5 5 src, 6 - docCargoDeps, 6 + # For Lix versions >= 2.92, Rust sources are in the Lix repository root. 7 + cargoDeps ? null, 8 + # For previous versions, Rust sources are only in a subdirectory for 9 + # `lix-doc`. 10 + docCargoDeps ? null, 7 11 patches ? [ ], 8 12 maintainers ? lib.teams.lix.members, 9 13 }@args: 10 14 15 + assert lib.assertMsg ( 16 + lib.versionOlder version "2.92" -> docCargoDeps != null 17 + ) "`lix-doc` `cargoDeps` must be set for Lix < 2.92"; 18 + assert lib.assertMsg ( 19 + lib.versionAtLeast version "2.92" -> cargoDeps != null 20 + ) "`cargoDeps` must be set for Lix ≥ 2.92"; 21 + 11 22 { 12 23 stdenv, 13 24 meson, ··· 18 29 busybox-sandbox-shell, 19 30 bzip2, 20 31 callPackage, 32 + capnproto, 33 + cargo, 21 34 curl, 22 35 cmake, 23 36 doxygen, ··· 30 43 libarchive, 31 44 libcpuid, 32 45 libsodium, 46 + llvmPackages, 33 47 lowdown, 34 48 lowdown-unsandboxed, 35 49 lsof, ··· 39 53 nlohmann_json, 40 54 ninja, 41 55 openssl, 56 + rustc, 42 57 toml11, 43 58 pegtl, 44 59 python3, ··· 47 62 Security, 48 63 sqlite, 49 64 util-linuxMinimal, 65 + removeReferencesTo, 50 66 xz, 51 67 nixosTests, 68 + rustPlatform, 69 + # Only used for versions before 2.92. 52 70 lix-doc ? callPackage ./doc { 53 71 inherit src; 54 72 version = "${version}${suffix}"; ··· 57 75 58 76 enableDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform, 59 77 enableStatic ? stdenv.hostPlatform.isStatic, 78 + enableStrictLLVMChecks ? true, 60 79 withAWS ? !enableStatic && (stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isDarwin), 61 80 aws-sdk-cpp, 62 81 # RISC-V support in progress https://github.com/seccomp/libseccomp/pull/50 ··· 67 86 stateDir, 68 87 storeDir, 69 88 }: 70 - 71 89 let 90 + isLLVMOnly = lib.versionAtLeast version "2.92"; 91 + hasExternalLixDoc = lib.versionOlder version "2.92"; 72 92 isLegacyParser = lib.versionOlder version "2.91"; 73 93 in 74 - stdenv.mkDerivation { 94 + # gcc miscompiles coroutines at least until 13.2, possibly longer 95 + # do not remove this check unless you are sure you (or your users) will not report bugs to Lix upstream about GCC miscompilations. 96 + assert lib.assertMsg (enableStrictLLVMChecks && isLLVMOnly -> stdenv.cc.isClang) 97 + "Lix upstream strongly discourage the usage of GCC to compile Lix as there's known miscompilations in important places. If you are a compiler developer, please get in touch with us."; 98 + stdenv.mkDerivation (finalAttrs: { 75 99 pname = "lix"; 76 100 77 101 version = "${version}${suffix}"; ··· 91 115 ]; 92 116 93 117 strictDeps = true; 118 + disallowedReferences = lib.optionals isLLVMOnly [ 119 + # We don't want the Clang. 120 + stdenv.cc.cc 121 + # We don't want the underlying GCC neither! 122 + stdenv.cc.cc.stdenv.cc.cc 123 + ]; 124 + 125 + # We only include CMake so that Meson can locate toml11, which only ships CMake dependency metadata. 126 + dontUseCmakeConfigure = true; 94 127 95 128 nativeBuildInputs = 96 129 [ 130 + # python3.withPackages does not splice properly, see https://github.com/NixOS/nixpkgs/issues/305858 131 + (python3.pythonOnBuildForHost.withPackages (p: [ 132 + p.pytest 133 + p.pytest-xdist 134 + p.python-frontmatter 135 + ])) 97 136 pkg-config 98 137 flex 99 138 jq ··· 101 140 ninja 102 141 cmake 103 142 python3 143 + # Required for libstd++ assertions that leaks inside of the final binary. 144 + removeReferencesTo 104 145 105 146 # Tests 106 147 git ··· 108 149 jq 109 150 lsof 110 151 ] 152 + ++ lib.optionals isLLVMOnly [ 153 + rustc 154 + cargo 155 + rustPlatform.cargoSetupHook 156 + ] 111 157 ++ lib.optionals isLegacyParser [ bison ] 112 158 ++ lib.optionals enableDocumentation [ 113 159 (lib.getBin lowdown-unsandboxed) ··· 123 169 brotli 124 170 bzip2 125 171 curl 172 + capnproto 126 173 editline 127 174 libsodium 128 175 openssl ··· 133 180 lowdown 134 181 rapidcheck 135 182 toml11 136 - lix-doc 137 183 ] 184 + ++ lib.optionals hasExternalLixDoc [ lix-doc ] 138 185 ++ lib.optionals (!isLegacyParser) [ pegtl ] 139 186 ++ lib.optionals stdenv.hostPlatform.isDarwin [ Security ] 187 + # NOTE(Raito): I'd have expected that the LLVM packaging would inject the 188 + # libunwind library path directly in the wrappers, but it does inject 189 + # -lunwind without injecting the library path... 190 + ++ lib.optionals stdenv.hostPlatform.isStatic [ llvmPackages.libunwind ] 140 191 ++ lib.optionals (stdenv.hostPlatform.isx86_64) [ libcpuid ] 141 192 ++ lib.optionals withLibseccomp [ libseccomp ] 142 193 ++ lib.optionals withAWS [ aws-sdk-cpp ]; 143 194 195 + inherit cargoDeps; 196 + 197 + env = { 198 + # Meson allows referencing a /usr/share/cargo/registry shaped thing for subproject sources. 199 + # Turns out the Nix-generated Cargo dependencies are named the same as they 200 + # would be in a Cargo registry cache. 201 + MESON_PACKAGE_CACHE_DIR = 202 + if finalAttrs.cargoDeps != null then 203 + finalAttrs.cargoDeps 204 + else 205 + "lix: no `MESON_PACKAGE_CACHE_DIR`, set `cargoDeps`"; 206 + }; 207 + 144 208 propagatedBuildInputs = [ 145 209 boehmgc 146 210 nlohmann_json ··· 179 243 mesonFlags = 180 244 [ 181 245 # Enable LTO, since it improves eval performance a fair amount 182 - # LTO is disabled on static due to strange linking errors 183 - (lib.mesonBool "b_lto" (!stdenv.hostPlatform.isStatic && stdenv.cc.isGNU)) 246 + # LTO is disabled on: 247 + # - static builds (strange linkage errors) 248 + (lib.mesonBool "b_lto" (!stdenv.hostPlatform.isStatic && (isLLVMOnly || stdenv.cc.isGNU))) 184 249 (lib.mesonEnable "gc" true) 185 250 (lib.mesonBool "enable-tests" true) 186 251 (lib.mesonBool "enable-docs" enableDocumentation) ··· 208 273 mkdir -p $devdoc/nix-support 209 274 echo "devdoc internal-api $devdoc/share/doc/nix/internal-api" >> $devdoc/nix-support/hydra-build-products 210 275 '' 276 + + lib.optionalString (!hasExternalLixDoc) '' 277 + # We do not need static archives. 278 + # FIXME(Raito): why are they getting installed _at all_ ? 279 + rm $out/lib/liblix_doc.a 280 + '' 211 281 + lib.optionalString stdenv.hostPlatform.isStatic '' 212 282 mkdir -p $out/nix-support 213 283 echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products ··· 219 289 "$out/lib/libboost_context.dylib" \ 220 290 "$out/lib/$lib" 221 291 done 292 + '' 293 + + '' 294 + # Drop all references to libstd++ include files due to `__FILE__` leaking in libstd++ assertions. 295 + find "$out" -type f -exec remove-references-to -t ${stdenv.cc.cc.stdenv.cc.cc} '{}' + 222 296 ''; 223 297 224 298 # This needs to run after _multioutDocs moves the docs to $doc ··· 277 351 inherit aws-sdk-cpp boehmgc; 278 352 tests = { 279 353 misc = nixosTests.nix-misc.lix; 354 + installer = nixosTests.installer.lix-simple; 280 355 }; 281 356 }; 282 357 ··· 299 374 outputsToInstall = [ "out" ] ++ lib.optional enableDocumentation "man"; 300 375 mainProgram = "nix"; 301 376 }; 302 - } 377 + })
+3 -2
pkgs/tools/package-management/lix/common-nix-eval-jobs.nix
··· 17 17 pkg-config, 18 18 ninja, 19 19 cmake, 20 - clang-tools, 20 + buildPackages, 21 21 }: 22 22 23 23 stdenv.mkDerivation { ··· 35 35 ninja 36 36 # nlohmann_json can be only discovered via cmake files 37 37 cmake 38 - ] ++ (lib.optional stdenv.cc.isClang [ clang-tools ]); 38 + ] ++ (lib.optional stdenv.cc.isClang [ buildPackages.clang-tools ]); 39 39 40 40 # point 'nix edit' and ofborg at the file that defines the attribute, 41 41 # not this common file. ··· 52 52 license = lib.licenses.gpl3; 53 53 inherit maintainers; 54 54 platforms = lib.platforms.unix; 55 + broken = stdenv.hostPlatform.isStatic; 55 56 }; 56 57 }
+52 -4
pkgs/tools/package-management/lix/default.nix
··· 8 8 rustPlatform, 9 9 Security, 10 10 newScope, 11 + editline, 12 + ncurses, 13 + stdenv, 14 + clangStdenv, 11 15 12 16 storeDir ? "/nix/store", 13 17 stateDir ? "/nix/var", ··· 19 23 lix-args, 20 24 nix-eval-jobs-args, 21 25 }: 26 + let 27 + # GCC 13.2 is known to miscompile Lix coroutines (introduced in 2.92). 28 + lixStdenv = if lib.versionAtLeast lix-args.version "2.92" then clangStdenv else stdenv; 29 + in 22 30 lib.makeScope newScope ( 23 31 self: 24 32 lib.recurseIntoAttrs { ··· 58 66 requiredSystemFeatures = [ ]; 59 67 }; 60 68 69 + editline = editline.override { 70 + inherit ncurses; 71 + enableTermcap = true; 72 + }; 73 + 61 74 # NOTE: The `common-*.nix` helpers contain a top-level function which 62 75 # takes the Lix source to build and version information. We use the 63 76 # outer `callPackage` for that. ··· 65 78 # That *returns* another function which takes the actual build 66 79 # dependencies, and that uses the new scope's `self.callPackage` so 67 80 # that `nix-eval-jobs` can be built against the correct `lix` version. 68 - lix = self.callPackage (callPackage ./common-lix.nix lix-args) { }; 81 + lix = self.callPackage (callPackage ./common-lix.nix lix-args) { 82 + stdenv = lixStdenv; 83 + }; 69 84 70 - nix-eval-jobs = self.callPackage (callPackage ./common-nix-eval-jobs.nix nix-eval-jobs-args) { }; 85 + nix-eval-jobs = self.callPackage (callPackage ./common-nix-eval-jobs.nix nix-eval-jobs-args) { 86 + stdenv = lixStdenv; 87 + }; 71 88 } 72 89 ); 73 - 74 90 in 75 91 lib.makeExtensible (self: { 76 92 inherit makeLixScope; ··· 135 151 }; 136 152 }; 137 153 138 - latest = self.lix_2_91; 154 + lix_2_92 = self.makeLixScope { 155 + lix-args = rec { 156 + version = "2.92.0"; 157 + 158 + src = fetchFromGitHub { 159 + owner = "lix-project"; 160 + repo = "lix"; 161 + rev = version; 162 + hash = "sha256-CCKIAE84dzkrnlxJCKFyffAxP3yfsOAbdvydUGqq24g="; 163 + }; 164 + 165 + cargoDeps = rustPlatform.fetchCargoVendor { 166 + name = "lix-${version}"; 167 + inherit src; 168 + allowGitDependencies = false; 169 + hash = "sha256-YMyNOXdlx0I30SkcmdW/6DU0BYc3ZOa2FMJSKMkr7I8="; 170 + }; 171 + }; 172 + 173 + nix-eval-jobs-args = rec { 174 + version = "2.92.0"; 175 + src = fetchgit { 176 + url = "https://git.lix.systems/lix-project/nix-eval-jobs.git"; 177 + rev = version; 178 + hash = "sha256-tPr61X9v/OMVt7VXOs1RRStciwN8gDGxEKx+h0/Fg48="; 179 + }; 180 + }; 181 + }; 182 + 183 + latest = self.lix_2_92; 184 + 185 + # Note: This is not yet 2.92 because of a non-deterministic `curl` error. 186 + # See: https://git.lix.systems/lix-project/lix/issues/662 139 187 stable = self.lix_2_91; 140 188 141 189 # Previously, `nix-eval-jobs` was not packaged here, so we export an