Skip to content

Commit

Permalink
Merge pull request #12229 from RossComputerGuy/feat/llvm
Browse files Browse the repository at this point in the history
Add LLVM to Flake
  • Loading branch information
roberth authored Jan 15, 2025
2 parents 8aafc05 + 47cf93b commit 61467b7
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
in {
inherit stdenvs native;
static = native.pkgsStatic;
llvm = native.pkgsLLVM;
cross = forAllCrossSystems (crossSystem: make-pkgs crossSystem "stdenv");
});

Expand Down Expand Up @@ -282,6 +283,7 @@
# These attributes go right into `packages.<system>`.
"${pkgName}" = nixpkgsFor.${system}.native.nixComponents.${pkgName};
"${pkgName}-static" = nixpkgsFor.${system}.static.nixComponents.${pkgName};
"${pkgName}-llvm" = nixpkgsFor.${system}.llvm.nixComponents.${pkgName};
}
// lib.optionalAttrs supportsCross (flatMapAttrs (lib.genAttrs crossSystems (_: { })) (crossSystem: {}: {
# These attributes go right into `packages.<system>`.
Expand Down Expand Up @@ -321,6 +323,9 @@
prefixAttrs "static" (forAllStdenvs (stdenvName: makeShell {
pkgs = nixpkgsFor.${system}.stdenvs."${stdenvName}Packages".pkgsStatic;
})) //
prefixAttrs "llvm" (forAllStdenvs (stdenvName: makeShell {
pkgs = nixpkgsFor.${system}.stdenvs."${stdenvName}Packages".pkgsLLVM;
})) //
prefixAttrs "cross" (forAllCrossSystems (crossSystem: makeShell {
pkgs = nixpkgsFor.${system}.cross.${crossSystem};
}))
Expand Down
2 changes: 1 addition & 1 deletion src/libcmd/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ mkMesonLibrary (finalAttrs: {
(lib.mesonOption "readline-flavor" readlineFlavor)
];

env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) {
env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux") && !(stdenv.hostPlatform.useLLVM or false)) {
LDFLAGS = "-fuse-ld=gold";
};

Expand Down
2 changes: 1 addition & 1 deletion src/libexpr/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ mkMesonLibrary (finalAttrs: {
# https://github.com/NixOS/nixpkgs/issues/86131.
BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
} // lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) {
} // lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux") && !(stdenv.hostPlatform.useLLVM or false)) {
LDFLAGS = "-fuse-ld=gold";
};

Expand Down
2 changes: 1 addition & 1 deletion src/libfetchers/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ mkMesonLibrary (finalAttrs: {
echo ${version} > ../../.version
'';

env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) {
env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux") && !(stdenv.hostPlatform.useLLVM or false)) {
LDFLAGS = "-fuse-ld=gold";
};

Expand Down
2 changes: 1 addition & 1 deletion src/libflake/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ mkMesonLibrary (finalAttrs: {
echo ${version} > ../../.version
'';

env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) {
env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux") && !(stdenv.hostPlatform.useLLVM or false)) {
LDFLAGS = "-fuse-ld=gold";
};

Expand Down
2 changes: 1 addition & 1 deletion src/libmain/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ mkMesonLibrary (finalAttrs: {
echo ${version} > ../../.version
'';

env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) {
env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux") && !(stdenv.hostPlatform.useLLVM or false)) {
LDFLAGS = "-fuse-ld=gold";
};

Expand Down
2 changes: 1 addition & 1 deletion src/libstore/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ mkMesonLibrary (finalAttrs: {
# https://github.com/NixOS/nixpkgs/issues/86131.
BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
} // lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) {
} // lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux") && !(stdenv.hostPlatform.useLLVM or false)) {
LDFLAGS = "-fuse-ld=gold";
};

Expand Down
2 changes: 1 addition & 1 deletion src/libutil/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ mkMesonLibrary (finalAttrs: {
# https://github.com/NixOS/nixpkgs/issues/86131.
BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
} // lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) {
} // lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux") && !(stdenv.hostPlatform.useLLVM or false)) {
LDFLAGS = "-fuse-ld=gold";
};

Expand Down
2 changes: 1 addition & 1 deletion src/nix/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ mkMesonExecutable (finalAttrs: {
mesonFlags = [
];

env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) {
env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux") && !(stdenv.hostPlatform.useLLVM)) {
LDFLAGS = "-fuse-ld=gold";
};

Expand Down

0 comments on commit 61467b7

Please sign in to comment.