Skip to content

Instantly share code, notes, and snippets.

@pta2002
Created November 9, 2020 11:40
Show Gist options
  • Save pta2002/a99db82cde6c5d141d550da0789c53a9 to your computer and use it in GitHub Desktop.
Save pta2002/a99db82cde6c5d141d550da0789c53a9 to your computer and use it in GitHub Desktop.
{ stdenv, bundlerEnv, ruby, v8, pkgs, which, python }:
let
gems = bundlerEnv {
name = "feedbin-env";
inherit ruby;
gemdir = ./.;
gemConfig = pkgs.defaultGemConfig // {
libv8 = attrs: {
buildFlags = [ "--with-system-v8=true" "--with-v8-dir=${v8}" ];
buildInputs = [ v8 python which ];
dontBuild = false;
postPatch = ''
substituteInPlace ext/libv8/extconf.rb \
--replace "location = Libv8::Location::Vendor.new" \
"location = Libv8::Location::System.new"
'';
};
};
};
in stdenv.mkDerivation {
name = "feedbin";
src = ./.;
buildInputs = [ gems ruby ];
installPhase = ''
mkdir -p $out/{bin,share/feedbin}
cp -r * $out/share/feedbin
bin=$out/bin/feedbin
cat > $bin <<EOF
#!/bin/sh -e
exec ${gems}/bin/bundle exec foreman start
EOF
chmod +x $bin
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment