33 lines
748 B
Nix
33 lines
748 B
Nix
{ stdenv, bundlerEnv, ruby_2_7, callPackage
|
|
|
|
, pname ? "diaspora"
|
|
, version ? import ./version.nix
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
inherit pname version;
|
|
|
|
diasporaGems = bundlerEnv {
|
|
name = "${pname}-gems-${version}";
|
|
version = version;
|
|
ruby = ruby_2_7;
|
|
gemdir = callPackage ./source.nix {};
|
|
gemset = ./gemset.nix;
|
|
};
|
|
|
|
name = "diaspora";
|
|
src = ./.;
|
|
buildInputs = [diasporaGems ruby];
|
|
installPhase = ''
|
|
mkdir -p $out/{bin,share/diaspora}
|
|
cp -r * $out/share/diaspora
|
|
bin=$out/bin/diaspora
|
|
# we are using bundle exec to start in the bundled environment
|
|
cat > $bin <<EOF
|
|
#!/bin/sh -e
|
|
exec ${diasporaGems}/bin/bundle exec ${ruby}/bin/ruby $out/share/diaspora/diaspora "\$@"
|
|
EOF
|
|
chmod +x $bin
|
|
'';
|
|
}
|