Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/applications/misc/mepo/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
installPhase = ''
runHook preInstall

zig build -Drelease-safe=true -Dcpu=baseline --prefix $out install
zig build -Drelease-safe=true --prefix $out install
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"install" is the default build step and can therefore be omitted, having the same effect as before:

Suggested change
zig build -Drelease-safe=true --prefix $out install
zig build -Drelease-safe=true -Dcpu=baseline --prefix $out

install -d $out/share/man/man1
$out/bin/mepo -docman > $out/share/man/man1/mepo.1

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/misc/rivercarro/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ stdenv.mkDerivation rec {

installPhase = ''
runHook preInstall
zig build -Drelease-safe -Dcpu=baseline --prefix $out install
zig build -Drelease-safe --prefix $out install
runHook postInstall
'';

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/misc/waylock/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ stdenv.mkDerivation rec {

installPhase = ''
runHook preInstall
zig build -Drelease-safe -Dman-pages -Dcpu=baseline --prefix $out install
zig build -Drelease-safe -Dman-pages --prefix $out install
runHook postInstall
'';

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/window-managers/river/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ stdenv.mkDerivation rec {

installPhase = ''
runHook preInstall
zig build -Drelease-safe -Dcpu=baseline ${lib.optionalString xwaylandSupport "-Dxwayland"} -Dman-pages --prefix $out install
zig build -Drelease-safe ${lib.optionalString xwaylandSupport "-Dxwayland"} -Dman-pages --prefix $out install
install contrib/river.desktop -Dt $out/share/wayland-sessions
runHook postInstall
'';
Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/compilers/zig/0.10.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ stdenv.mkDerivation rec {
hash = "sha256-69QIkkKzApOGfrBdgtmxFMDytRkSh+0YiaJQPbXsBeo=";
};

patches = [
# Fix impurities.
./cpu-purity.patch
];

nativeBuildInputs = [
cmake
llvmPackages.llvm.dev
Expand Down
2 changes: 2 additions & 0 deletions pkgs/development/compilers/zig/0.9.1.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ stdenv.mkDerivation rec {
};

patches = [
# Fix impurities.
./cpu-purity.patch
# Fix index out of bounds reading RPATH (cherry-picked from 0.10-dev)
./rpath.patch
# Fix build on macOS 13 (cherry-picked from 0.10-dev)
Expand Down
20 changes: 20 additions & 0 deletions pkgs/development/compilers/zig/cpu-purity.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
By default, Zig will use the generate code for the native CPU. This is impure.
Change the default to -mcpu=baseline.

https://github.com/NixOS/nixpkgs/issues/169461
https://github.com/NixOS/nixpkgs/issues/214356
https://github.com/NixOS/nixpkgs/issues/185665

diff --git a/lib/std/zig/CrossTarget.zig b/lib/std/zig/CrossTarget.zig
index 6c59a4a3a..d45e9ab5a 100644
--- a/lib/std/zig/CrossTarget.zig
+++ b/lib/std/zig/CrossTarget.zig
@@ -12,7 +12,7 @@ const mem = std.mem;
/// `null` means native.
cpu_arch: ?Target.Cpu.Arch = null,

-cpu_model: CpuModel = CpuModel.determined_by_cpu_arch,
+cpu_model: CpuModel = CpuModel.baseline,

/// Sparse set of CPU features to add to the set from `cpu_model`.
cpu_features_add: Target.Cpu.Feature.Set = Target.Cpu.Feature.Set.empty,
2 changes: 1 addition & 1 deletion pkgs/development/tools/zls/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
'';

installPhase = ''
zig build -Drelease-safe -Dcpu=baseline --prefix $out install
zig build -Drelease-safe --prefix $out install
'';

meta = with lib; {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/games/blackshades/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
'';

installPhase = ''
zig build -Drelease-fast -Dcpu=baseline --prefix $out install
zig build -Drelease-fast --prefix $out install
'';

meta = {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/tools/misc/clipbuzz/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
'';

installPhase = ''
zig build -Drelease-safe -Dcpu=baseline --prefix $out install
zig build -Drelease-safe --prefix $out install
'';

meta = with lib; {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/tools/misc/findup/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ stdenv.mkDerivation rec {

installPhase = ''
runHook preInstall
zig build -Drelease-safe -Dcpu=baseline --prefix $out
zig build -Drelease-safe --prefix $out
runHook postInstall
'';

Expand Down
3 changes: 1 addition & 2 deletions pkgs/tools/misc/ncdu/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ stdenv.mkDerivation rec {

PREFIX = placeholder "out";

# Avoid CPU feature impurity, see https://github.com/NixOS/nixpkgs/issues/169461
ZIG_FLAGS = "-Drelease-safe -Dcpu=baseline";
ZIG_FLAGS = "-Drelease-safe";

meta = with lib; {
description = "Disk usage analyzer with an ncurses interface";
Expand Down