Issues with nix reproducibility on MacOS, trying to build nokogiri (ruby): error: unknown warning option

I don’t think the clang error is the problem. When I attempted to build your flake, it said it couldn’t find mini_portile2. I made some changes and was able to get it to build, but it gives an error regarding concurrent-ruby-1.10. I also had to hand edit the lockfile to remove the platform-specific version of nokogiri (not sure if related to Add support for platform-dependant pre-compiled gems by lavoiesl · Pull Request #68 · nix-community/bundix · GitHub).

diff --git a/Gemfile b/Gemfile
index 8d0cbff..a5e316f 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,3 +3,4 @@ gem 'github-pages', group: :jekyll_plugins
 gem 'guard'
 gem 'guard-livereload'
 gem 'html-proofer'
+gem 'mini_portile2', '~> 2.8.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index 48aad2f..5528906 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -234,6 +234,7 @@ GEM
     lumberjack (1.2.8)
     mercenary (0.3.6)
     method_source (1.0.0)
+    mini_portile2 (2.8.0)
     minima (2.5.1)
       jekyll (>= 3.5, < 5.0)
       jekyll-feed (~> 0.9)
@@ -241,7 +242,7 @@ GEM
     minitest (5.16.3)
     multi_json (1.15.0)
     nenv (0.3.0)
-    nokogiri (1.13.8-arm64-darwin)
+    nokogiri (1.13.8)
       racc (~> 1.4)
     notiffany (0.1.3)
       nenv (~> 0.1)
@@ -300,6 +301,7 @@ DEPENDENCIES
   guard
   guard-livereload
   html-proofer
+  mini_portile2 (~> 2.8.0)
 
 BUNDLED WITH
    2.3.20
diff --git a/flake.nix b/flake.nix
index 4ff5409..f210f53 100644
--- a/flake.nix
+++ b/flake.nix
@@ -16,8 +16,24 @@
         name = "n8henrie.com";
         gemdir = ./.;
 
+        gemConfig.ffi = attrs: {
+          buildInputs = [ pkgs.libffi ];
+        };
         gemConfig.nokogiri = attrs: {
-          buildInputs = [ pkgs.zlib ];
+          buildFlags = with pkgs; [
+            "--use-system-libraries"
+            "--with-zlib-dir=${zlib.dev}"
+            "--with-zlib-lib=${zlib.out}/lib"
+            "--with-zlib-include=${zlib.dev}/include"
+            "--with-xml2-lib=${libxml2.out}/lib"
+            "--with-xml2-include=${libxml2.dev}/include/libxml2"
+            "--with-xslt-lib=${libxslt.out}/lib"
+            "--with-xslt-include=${libxslt.dev}/include"
+            "--with-exslt-lib=${libxslt.out}/lib"
+            "--with-exslt-include=${libxslt.dev}/include"
+            "--with-iconv-dir=${libiconv}"
+          ];
+          dependencies = attrs.dependencies ++ ["mini_portile2"];
         };
       };
     in
@@ -31,8 +47,6 @@
           buildInputs = [
             bundix
             gems
-            libffi
-            pkgconfig
             ruby
           ];
           shellHook = ''
diff --git a/gemset.nix b/gemset.nix
index 7d10656..5af7f17 100644
--- a/gemset.nix
+++ b/gemset.nix
@@ -771,6 +771,16 @@
     };
     version = "1.0.0";
   };
+  mini_portile2 = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0rapl1sfmfi3bfr68da4ca16yhc0pp93vjwkj7y3rdqrzy3b41hy";
+      type = "gem";
+    };
+    version = "2.8.0";
+  };
   minima = {
     dependencies = ["jekyll" "jekyll-feed" "jekyll-seo-tag"];
     groups = ["default" "jekyll_plugins"];