From 7aee32121aab12571a3d9b20992d1b61c76d3f58 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Sun, 25 Oct 2020 15:48:37 +0100 Subject: [PATCH 1/2] ruby: make the build reproducible ext/io/console/io-console.gemspec was embedding a timestamp which made the build not reproducible. Gems respect SOURCE_DATE_EPOCH so it's enough to just delete that line if it exists. This file has been fixed in https://github.com/ruby/io-console/commit/679a941d05d869f5e575730f6581c027203b7b26#diff-d8422f096931c58d4463e2489f62a228b0f24f0492950ba88c8c89a0d741cfe6 And then ruby regularly merges that gem into their own repository. Ruby master is fixed but none of the ruby releases have been fixed yet. lib/ruby/gems/2.6.0/specifications/default/io-console-0.4.7.gemspec now contains: s.date = "1980-01-01" --- pkgs/development/interpreters/ruby/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix index 7b36b04d114..189be8945fa 100644 --- a/pkgs/development/interpreters/ruby/default.nix +++ b/pkgs/development/interpreters/ruby/default.nix @@ -108,6 +108,9 @@ let sed -i configure.ac -e '/config.guess/d' cp --remove-destination ${config}/config.guess tool/ cp --remove-destination ${config}/config.sub tool/ + # Make the build reproducible for ruby <= 2.7 + # See https://github.com/ruby/io-console/commit/679a941d05d869f5e575730f6581c027203b7b26#diff-d8422f096931c58d4463e2489f62a228b0f24f0492950ba88c8c89a0d741cfe6 + sed -i ext/io/console/io-console.gemspec -e '/s\.date/d' ''; # Force the revision.h generation. Somehow `revision.tmp` is an empty From c3357d2cd919ae6b0d055ad04738bef3a2309231 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Sun, 25 Oct 2020 16:58:05 +0100 Subject: [PATCH 2/2] buildRubyGem: remove Makefiles The generated Makefile is not reproducible. The HDRS section is inode dependent. "sitearchdir" and "sitelibdir" contains a timestamp and random postfix. See https://r13y.com/diff/8350ec80865096f84705f3e000d97f151760e768bf626e52c84570413c5e1093-f9dea788fe62d683e90e12e166f29b778c39c699a5be39f9262e5cffb77d3e45.html Instead of trying to make it reproducible, remove it entirely. It was only useful for generating the .so file and it no longer needed. See also https://bugs.ruby-lang.org/issues/15304 Fixes the rubyPackages.nokogiry reproducibility for example. --- pkgs/development/ruby-modules/gem/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/ruby-modules/gem/default.nix b/pkgs/development/ruby-modules/gem/default.nix index 158d5891ec3..910949d847c 100644 --- a/pkgs/development/ruby-modules/gem/default.nix +++ b/pkgs/development/ruby-modules/gem/default.nix @@ -207,7 +207,7 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // { # looks like useless files which break build repeatability and consume space pushd $out/${ruby.gemPath} rm -fv doc/*/*/created.rid || true - rm -fv {gems/*/ext/*,extensions/*/*/*}/{mkmf.log,gem_make.out} || true + rm -fv {gems/*/ext/*,extensions/*/*/*}/{Makefile,mkmf.log,gem_make.out} || true rm -fvr cache popd