loomio-nix/pkg/loomio/default.nix

31 lines
686 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 -e
export BUNDLE_FORCE_RUBY_PLATFORM=true
exec ${gems}/bin/bundle exec puma -C $out/share/loomio/config/puma.rb
EOF
chmod +x $bin
'';
}