nix-community / bundix

Generates a Nix expression for your Bundler-managed application. [maintainer=@manveru]
160 stars 54 forks source link

wrong hash for google-protobuf-3.23.3 #109

Open brianmay opened 1 year ago

brianmay commented 1 year ago

Gemfile:

source 'https://rubygems.org'

gem 'jekyll'

gem "html-proofer"

group :jekyll_plugins do
      gem 'RbST'
      gem 'jekyll-paginate'
      gem 'jekyll-environment-variables'
end

flake.nix:

{
  description = "Brian's website";

  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};

        # Generate a user-friendly version number.
        version = builtins.substring 0 8 self.lastModifiedDate;

        gems = pkgs.bundlerEnv {
          name = "gems";
          ruby = pkgs.ruby;
          # gemfile = ./Gemfile;
          # lockfile = ./Gemfile.lock;
          # gemset = ./gemset.nix;
          gemdir = ./.;
        };

      in {
        packages.default = pkgs.stdenv.mkDerivation {
          name = "penguin_brian-${version}";
          src = ./.;
          buildInputs = [ gems ];
          buildPhase = ''
            export VCS_REF="${self.rev}"
            export BUILD_DATE="${version}"
            ${gems}/bin/jekyll build --destination _site
          '';
          installPhase = ''
            mkdir -p $out
            cp -r _site $out/_site
          '';
        };
        devShells.default =
          pkgs.mkShell { buildInputs = [ gems pkgs.bundix ]; };
      });
}

Script for testing:

#!/bin/sh
set -ex
rm gemset.nix Gemfile.lock
nix-shell -p bundler --command "bundle install"
nix-shell -p bundix --command "bundix -l"
nix shell

Gives:

+ nix shell
error: hash mismatch in fixed-output derivation '/nix/store/xjgf6kmjnv7ir3nc9b3vgyd6bihnprf3-google-protobuf-3.23.3.gem.drv':
         specified: sha256-ooB3Xmsyd7So4evckfK7eDe881Xj1VCFUUgpoHZfBAs=
            got:    sha256-TbwKKNuVnNN8y7BA2lxUt71nLvO5I9DdCpnqJsvfn6k=
error: 1 dependencies of derivation '/nix/store/pdn8sdpq1js03r1y74gb25wdm1pyypkz-ruby3.1.4-google-protobuf-3.23.3.drv' failed to build
error: 1 dependencies of derivation '/nix/store/7nq9b2f87w7xzh9ax0zrybb69971zkyr-gems.drv' failed to build
error: 1 dependencies of derivation '/nix/store/aj87kspn9jrlrm2yzmaa1m7lsijgp549-penguin_brian-20230704.drv' failed to build
rsoeldner commented 1 year ago

I actually run into this too.

brianmay commented 11 months ago

Work around is:

BUNDLE_FORCE_RUBY_PLATFORM=true nix run 'nixpkgs#bundix' -- --lock

I believe these issues are the same (although there are very different symptoms):

brianmay commented 11 months ago

Correction: appeared to work initially, but got the nokogiri build error back again.

fzakaria commented 4 days ago

I am hitting this too; just upgraded from an old version.

Very unfortunate.