From fdda4014c3457d7dc2d4ce2abea874f3d5a198bd Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Fri, 12 Dec 2025 11:16:14 -0800 Subject: [PATCH 1/3] Fix environment on macOS. --- flake.nix | 1 + pkgs/doctest/default.nix | 9 +++++++++ pkgs/proj/default.nix | 15 +++++++++------ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index 5677d23..c4f7fa3 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,7 @@ }; lib = pkgs.lib; + stdenv = pkgs.stdenv; packages = rec { proj = pkgs.python3Packages.callPackage ./pkgs/proj { diff --git a/pkgs/doctest/default.nix b/pkgs/doctest/default.nix index 53447e8..9540742 100644 --- a/pkgs/doctest/default.nix +++ b/pkgs/doctest/default.nix @@ -1,4 +1,5 @@ { pkgs +, fetchpatch }: pkgs.doctest.overrideAttrs ( old: rec { @@ -11,5 +12,13 @@ pkgs.doctest.overrideAttrs ( old: rec { }; patches = [ ./doctest-template-test.patch + + # Fix the build with Clang. + (fetchpatch { + name = "doctest-disable-warnings.patch"; + url = "https://github.com/doctest/doctest/commit/c8d9ed2398d45aa5425d913bd930f580560df30d.patch"; + excludes = [ ".github/workflows/main.yml" ]; + hash = "sha256-kOBy0om6MPM2vLXZjNLXiezZqVgNr/viBI7mXrOZts8="; + }) ]; }) diff --git a/pkgs/proj/default.nix b/pkgs/proj/default.nix index e319c81..1825ad0 100644 --- a/pkgs/proj/default.nix +++ b/pkgs/proj/default.nix @@ -27,6 +27,8 @@ , lcov , gdb , pytest-xdist +, lib +, stdenv # TODO use these if we ever update nixpkgs # , writableTmpDirAsHomeHook # , addBinAsPathHook @@ -35,16 +37,17 @@ let bins = [ - valgrind - kcachegrind - ff-clang-format - bencher-cli - hotspot - perf ccache compdb cmake lcov + ] ++ lib.optionals stdenv.isLinux [ + ff-clang-format + bencher-cli + hotspot + valgrind + kcachegrind + perf ]; in buildPythonApplication { From 2c1bf9d570e55c469de06e7649767f221d0f1a11 Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Fri, 12 Dec 2025 11:31:54 -0800 Subject: [PATCH 2/3] Take pkgs instead of lib/stdenv variables. --- flake.nix | 3 --- pkgs/proj/default.nix | 8 +++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index c4f7fa3..ecacc67 100644 --- a/flake.nix +++ b/flake.nix @@ -15,9 +15,6 @@ config.allowUnfree = true; }; - lib = pkgs.lib; - stdenv = pkgs.stdenv; - packages = rec { proj = pkgs.python3Packages.callPackage ./pkgs/proj { inherit pytest-skip-slow; diff --git a/pkgs/proj/default.nix b/pkgs/proj/default.nix index 1825ad0..ef3a3dd 100644 --- a/pkgs/proj/default.nix +++ b/pkgs/proj/default.nix @@ -1,4 +1,5 @@ -{ buildPythonApplication +{ pkgs +, buildPythonApplication , pytestCheckHook , typing-extensions , enlighten @@ -27,8 +28,6 @@ , lcov , gdb , pytest-xdist -, lib -, stdenv # TODO use these if we ever update nixpkgs # , writableTmpDirAsHomeHook # , addBinAsPathHook @@ -36,6 +35,9 @@ }: let + lib = pkgs.lib; + stdenv = pkgs.stdenv; + bins = [ ccache compdb From 027b20f6c977c84d1f6ec999b265b76ea720c23b Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Fri, 12 Dec 2025 14:10:55 -0800 Subject: [PATCH 3/3] Put clang-format back. --- pkgs/ff-clang-format.nix | 24 +++++++++++++++++------- pkgs/proj/default.nix | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/pkgs/ff-clang-format.nix b/pkgs/ff-clang-format.nix index 4807b8f..130558b 100644 --- a/pkgs/ff-clang-format.nix +++ b/pkgs/ff-clang-format.nix @@ -1,4 +1,5 @@ -{ stdenv +{ pkgs +, stdenv , lib , autoPatchelfHook , fetchurl @@ -10,12 +11,21 @@ stdenv.mkDerivation rec { system = "x86_64-linux"; - src = fetchurl { - url = "https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/${version}/clang-format-16_linux-amd64"; - hash = "sha256-5eTzOVcmuvSNGr2lyQrBO2Rs0vOed5k7ICPw0IPq4sE="; - }; + src = let + blobs = { + x86_64-linux = { + url = "https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/${version}/clang-format-16_linux-amd64"; + hash = "sha256-5eTzOVcmuvSNGr2lyQrBO2Rs0vOed5k7ICPw0IPq4sE="; + }; + x86_64-darwin = { + url = "https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/${version}/clang-format-16_macosx-amd64"; + hash = "sha256-I9F/mn3I+ZAq2aDw0Mc9Imo+AJMwbzsjalqBSo/7DL4="; + }; + }; + in + fetchurl blobs.${pkgs.system}; - nativeBuildInputs = [ + nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ]; @@ -29,6 +39,6 @@ stdenv.mkDerivation rec { meta = with lib; { homepage = "https://github.com/muttleyxd/clang-tools-static-binaries"; - platforms = platforms.linux; + platforms = platforms.linux ++ platforms.darwin; }; } diff --git a/pkgs/proj/default.nix b/pkgs/proj/default.nix index ef3a3dd..ccd71d5 100644 --- a/pkgs/proj/default.nix +++ b/pkgs/proj/default.nix @@ -39,12 +39,12 @@ let stdenv = pkgs.stdenv; bins = [ + ff-clang-format ccache compdb cmake lcov ] ++ lib.optionals stdenv.isLinux [ - ff-clang-format bencher-cli hotspot valgrind