Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Nixify HaLVM #86

Closed
dmjio opened this issue Dec 3, 2016 · 6 comments
Closed

Nixify HaLVM #86

dmjio opened this issue Dec 3, 2016 · 6 comments

Comments

@dmjio
Copy link
Contributor

dmjio commented Dec 3, 2016

@acw 馃憢 :)

The nix package manager allows someome to drop into an arbitrary shell w/ prebuilt haskell deps. (optionally profiled) w/ a GHC. It would be nice to add halvm-ghc to this list.

nix-repl> pkgs.haskell.compiler.
pkgs.haskell.compiler.ghc6102Binary  pkgs.haskell.compiler.ghc7103        pkgs.haskell.compiler.ghc784         pkgs.haskell.compiler.ghcjsHEAD
pkgs.haskell.compiler.ghc6104        pkgs.haskell.compiler.ghc722         pkgs.haskell.compiler.ghc801         pkgs.haskell.compiler.jhc
pkgs.haskell.compiler.ghc6123        pkgs.haskell.compiler.ghc742         pkgs.haskell.compiler.ghc802         pkgs.haskell.compiler.uhc
pkgs.haskell.compiler.ghc704         pkgs.haskell.compiler.ghc742Binary   pkgs.haskell.compiler.ghcHEAD        
pkgs.haskell.compiler.ghc704Binary   pkgs.haskell.compiler.ghc763         pkgs.haskell.compiler.ghcNokinds     
pkgs.haskell.compiler.ghc7102        pkgs.haskell.compiler.ghc783         pkgs.haskell.compiler.ghcjs    

So we could just do:

$ nix-shell -p "haskell.packages.ghcHaLVM (pkgs: with pkgs; [ BoundedChan ])"

Modifying this code would be a good starting point.
https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/compilers/ghc/head.nix

I'd like to start working on this, for ease of dev. w/ HaLVM.

@izgzhen
Copy link
Contributor

izgzhen commented Dec 3, 2016

Cool. How well NixOS supports Xen?

@dmjio
Copy link
Contributor Author

dmjio commented Dec 3, 2016

@izgzhen It's supported afaict, https://github.com/NixOS/nixos/blob/master/modules/virtualisation/xen-dom0.nix
https://nixos.org/wiki/NixOS_and_Xen

But this addition to nixpkgs would be moreso related to using the nix package manager, not necessarily NixOS, and the goal would be to get a working halvm-ghc and HaLVM environment setup fast, with any deps. you need. nix (package manager) just let's you sandbox your entire system, including language deps. system deps. If you use nix on NixOS you can declaratively specify systemd units and reify your configuration with sudo nixos-rebuild switch.

The nix package manager can run on any OS (best support for linux / darwin). So users should be able to write haskell code on any OS that ghc runs on and cross-compile to Xen using a nix-expression that references halvm-ghc w/ HaLVM.

On the GHCJS project, distribution of the compiler has been a major impediment to adoption. Some people put it on nixpkgs, and it's very simple to get a working environment setup, the only problem is the learning curve with nix. But knowledge of the entire lang. / eco-system isn't necessary if you want a working compiler fast.

Getting ghcjs from scratch

$ curl https://nixos.org/nix/install | sh
# copy . /home/<user>/.nix-profile/etc/profile.d/nix.sh   into your .bashrc
$ nix-shell -p "haskell.packages.ghcjs (pkgs: with pkgs; [ ghcjs-base, aeson ])"
# pulls prebuilt ghcjs from the hydra cache into your /nix/store and symlinks it into the shell below
[nix-shell:~]$  ghcsi --info
# ... etc

Lastly, it seems there is experimental support for generic ghc cross compilers:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/haskell-packages.nix#L135

@acw
Copy link
Contributor

acw commented Dec 7, 2016

I'm on board. Anything you need on the HaLVM side?

@Ericson2314
Copy link

@dmjio I'm quite interested in helping with this; in fact my motivation for https://github.com/NixOS/nixpkgs/pull/13131/files was in part hoping someone open just this issue!

@dmjio
Copy link
Contributor Author

dmjio commented Feb 23, 2017

NixOS/nixpkgs#23097 cc: @acw @izgzhen @Ericson2314 @elliottt

@dmjio
Copy link
Contributor Author

dmjio commented Mar 13, 2017

HaLVM-2.4.0 is on nixpkgs/master, closing.

@dmjio dmjio closed this as completed Mar 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants