33 lines
753 B
Nix
33 lines
753 B
Nix
{stdenv, callPackage, bundlerEnv, ruby_3_2 }:
|
|
|
|
let
|
|
gemfile-patch = callPackage ./gemfile-patch.nix {};
|
|
src = callPackage ./source.nix { patches = [gemfile-patch];};
|
|
gems = bundlerEnv {
|
|
name = "loomio-env";
|
|
ruby = ruby_3_2;
|
|
gemset = ./. + "/gemset.nix";
|
|
gemdir = src;
|
|
};
|
|
in stdenv.mkDerivation {
|
|
name = "loomio";
|
|
inherit src;
|
|
buildInputs = [gems ruby_3_2];
|
|
installPhase = ''
|
|
mkdir -p $out/{bin,share/loomio}
|
|
cp -r * $out/share/loomio
|
|
bin=$out/bin/loomio
|
|
cat > $bin <<EOF
|
|
#!/usr/bin/env bash
|
|
|
|
set -ex
|
|
export BUNDLE_FORCE_RUBY_PLATFORM=true
|
|
${gems}/bin/bundle exec rake -f $out/share/loomio/Rakefile db:prepare
|
|
${gems}/bin/bundle exec puma -C $out/share/loomio/config/puma.rb
|
|
|
|
EOF
|
|
|
|
chmod +x $bin
|
|
'';
|
|
}
|