3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/tools/haskell/hyper-haskell/default.nix
Jörg Thalheim dadc7eb329
treewide: use runtimeShell instead of stdenv.shell whenever possible
Whenever we create scripts that are installed to $out, we must use runtimeShell
in order to get the shell that can be executed on the machine we create the
package for. This is relevant for cross-compiling. The only use case for
stdenv.shell are scripts that are executed as part of the build system.
Usages in checkPhase are borderline however to decrease the likelyhood
of people copying the wrong examples, I decided to use runtimeShell as well.
2019-02-26 14:10:49 +00:00

52 lines
1.7 KiB
Nix

{ stdenv, fetchFromGitHub, jshon, electron
, runtimeShell, hyper-haskell-server, extra-packages ? [] }:
let
binPath = stdenv.lib.makeBinPath ([ hyper-haskell-server ] ++ extra-packages);
in stdenv.mkDerivation rec {
name = "hyper-haskell-${version}";
version = "0.1.0.2";
src = fetchFromGitHub {
owner = "HeinrichApfelmus";
repo = "hyper-haskell";
rev = "v${version}";
sha256 = "1k38h7qx12z7463z8466pji0nwfkp4qkg7q83kns2mzmwmw5jnmb";
};
propagatedBuildInputs = extra-packages;
buildCommand = ''
mkdir -p $out/bin $out/share/hyper-haskell/worksheets $out/share/applications $out/share/icons/hicolor/scalable/apps $out/share/mime/packages
# Electron app
cp -R $src/app $out
# Desktop Launcher
cp $src/resources/hyper-haskell.desktop $out/share/applications/hyper-haskell.desktop
cp $src/resources/icons/icon.svg $out/share/icons/hicolor/scalable/apps/hyper-haskell.svg
cp $src/resources/shared-mime-info.xml $out/share/mime/packages/hyper-haskell.xml
# install example worksheets with backend set to nix
for worksheet in "$src/worksheets/"*.hhs; do
${jshon}/bin/jshon -e settings -s nix -i packageTool -p < $worksheet > $out/share/hyper-haskell/worksheets/`basename $worksheet`
done
# install electron wrapper script
cat > $out/bin/hyper-haskell <<EOF
#!${runtimeShell}
export PATH="${binPath}:\$PATH"
exec ${electron}/bin/electron $out/app "\$@"
EOF
chmod 755 $out/bin/hyper-haskell
'';
meta = with stdenv.lib; {
description = "The strongly hyped graphical interpreter for the Haskell programming language";
homepage = "https://github.com/HeinrichApfelmus/hyper-haskell";
license = licenses.bsd3;
maintainers = [ maintainers.rvl ];
};
}