nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 callPackage,
4 stdenvAdapters,
5 buildPackages,
6 targetPackages,
7 stdenv,
8 pkgs,
9 # This is the default binutils, but with *this* version of LLD rather
10 # than the default LLVM version's, if LLD is the choice. We use these for
11 # the `useLLVM` bootstrapping below.
12 bootBintoolsNoLibc ? if stdenv.targetPlatform.linker == "lld" then null else pkgs.bintoolsNoLibc,
13 bootBintools ? if stdenv.targetPlatform.linker == "lld" then null else pkgs.bintools,
14 llvmVersions ? { },
15 generateSplicesForMkScope,
16 patchesFn ? lib.id,
17 # Allows passthrough to packages via newScope in ./common/default.nix.
18 # This makes it possible to do
19 # `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get
20 # an llvmPackages whose packages are overridden in an internally consistent way.
21 ...
22}@packageSetArgs:
23let
24 versions = {
25 "18.1.8".officialRelease.sha256 = "sha256-iiZKMRo/WxJaBXct9GdAcAT3cz9d9pnAcO1mmR6oPNE=";
26 "19.1.7".officialRelease.sha256 = "sha256-cZAB5vZjeTsXt9QHbP5xluWNQnAHByHtHnAhVDV0E6I=";
27 "20.1.8".officialRelease.sha256 = "sha256-ysyB/EYxi2qE9fD5x/F2zI4vjn8UDoo1Z9ukiIrjFGw=";
28 "21.1.8".officialRelease.sha256 = "sha256-pgd8g9Yfvp7abjCCKSmIn1smAROjqtfZaJkaUkBSKW0=";
29 "22.1.0-rc2".officialRelease.sha256 = "sha256-j0KSuTANrwLh/siEcztSqCYQQDYHmdBCgVCsPsDCQ+I=";
30 "23.0.0-git".gitRelease = {
31 rev = "eae75353f70b01363bab9383da6b4dd4324d13a3";
32 rev-version = "23.0.0-unstable-2026-01-25";
33 sha256 = "sha256-04oX8cMoyXmqtwqMW2/xbtIhUQlgcM9AOO2bnhfx0zs=";
34 };
35 }
36 // llvmVersions;
37
38 mkPackage =
39 {
40 name ? null,
41 officialRelease ? null,
42 gitRelease ? null,
43 monorepoSrc ? null,
44 version ? null,
45 }@args:
46 let
47 inherit
48 (import ./common/common-let.nix {
49 inherit lib;
50 inherit gitRelease officialRelease version;
51 })
52 releaseInfo
53 ;
54 inherit (releaseInfo) release_version;
55 attrName =
56 args.name or (if (gitRelease != null) then "git" else lib.versions.major release_version);
57 in
58 lib.nameValuePair attrName (
59 lib.recurseIntoAttrs (
60 callPackage ./common (
61 {
62 inherit (stdenvAdapters) overrideCC;
63 inherit
64 officialRelease
65 gitRelease
66 monorepoSrc
67 version
68 patchesFn
69 bootBintools
70 bootBintoolsNoLibc
71 ;
72
73 otherSplices = generateSplicesForMkScope "llvmPackages_${attrName}";
74 }
75 // packageSetArgs # Allow overrides.
76 )
77 )
78 );
79
80 llvmPackages = lib.mapAttrs' (version: args: mkPackage (args // { inherit version; })) versions;
81in
82llvmPackages // { inherit mkPackage versions; }