diff options
author | Rodney Lorrimar <dev@rodney.id.au> | 2017-07-22 21:14:52 +0100 |
---|---|---|
committer | Rodney Lorrimar <dev@rodney.id.au> | 2017-08-05 13:54:58 +0100 |
commit | bda581585185b167192d10148caea21448514204 (patch) | |
tree | 9c2a79cc27f2933a22e80037fc7801d69ded8fd6 /pkgs/development/tools/haskell | |
parent | a7c8f5e419ba07711c132bf81baaab0e74862cce (diff) |
hyper-haskell: init at 0.1.0.2
Diffstat (limited to 'pkgs/development/tools/haskell')
-rw-r--r-- | pkgs/development/tools/haskell/hyper-haskell/default.nix | 50 | ||||
-rw-r--r-- | pkgs/development/tools/haskell/hyper-haskell/server.nix | 21 |
2 files changed, 71 insertions, 0 deletions
diff --git a/pkgs/development/tools/haskell/hyper-haskell/default.nix b/pkgs/development/tools/haskell/hyper-haskell/default.nix new file mode 100644 index 0000000000000..31697750a702e --- /dev/null +++ b/pkgs/development/tools/haskell/hyper-haskell/default.nix @@ -0,0 +1,50 @@ +{ stdenv, fetchFromGitHub, writeText, jshon, electron, 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 + #!${stdenv.shell} + 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 ]; + }; +} diff --git a/pkgs/development/tools/haskell/hyper-haskell/server.nix b/pkgs/development/tools/haskell/hyper-haskell/server.nix new file mode 100644 index 0000000000000..ff82127f0c4b8 --- /dev/null +++ b/pkgs/development/tools/haskell/hyper-haskell/server.nix @@ -0,0 +1,21 @@ +{ stdenv, ghcWithPackages, makeWrapper, packages }: + +let +hyperHaskellEnv = ghcWithPackages (self: [ self.hyper-haskell-server ] ++ packages self); +in stdenv.mkDerivation { + name = "hyper-haskell-server-with-packages"; + + nativeBuildInputs = [ makeWrapper ]; + + buildCommand = '' + mkdir -p $out/bin + makeWrapper ${hyperHaskellEnv}/bin/hyper-haskell-server $out/bin/hyper-haskell-server \ + --set NIX_GHC ${hyperHaskellEnv}/bin/ghc \ + --set NIX_GHCPKG ${hyperHaskellEnv}/bin/ghc-pkg \ + --set NIX_GHC_LIBDIR ${hyperHaskellEnv}/lib/ghc-* + ''; + + # trivial derivation + preferLocalBuild = true; + allowSubstitutes = false; +} |