Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script for installing with nix #84

Open
anka-213 opened this issue Jul 10, 2020 · 0 comments
Open

Script for installing with nix #84

anka-213 opened this issue Jul 10, 2020 · 0 comments

Comments

@anka-213
Copy link

Here is a nix-file for installing hylogen with nix that worked for me:

Save as hylogen.nix, run (without installing) with nix run -f hylogen.nix -c hylide Example.hs, install with nix-env -if hylogen.nix

{ pkgs ? import <nixpkgs> {}, compiler ? "default" }:

let
  src = fetchTarball "https://github.com/sleexyz/hylogen/archive/master.tar.gz";
  oldHaskellPackages = if compiler == "default"
                       then pkgs.haskellPackages
                       else pkgs.haskell.packages.${compiler}; 
  haskellPackages = oldHaskellPackages.override {
    overrides = hpNew: hpOld: {
      hylogen = hpNew.callCabal2nix "hylogen" "${src}/hylogen" { };
      hylide = hpNew.callCabal2nix "hylide" "${src}/hylide" { };
    };
  };
  myGhc = haskellPackages.ghcWithPackages (ps: with ps; [ hylogen hylide ]);

  # Wrapper to make hint see the available 
  hylide-invoker = pkgs.stdenv.mkDerivation {
    name = "hylide-invoker";
    unpackPhase = "true";
    buildInputs = [ myGhc pkgs.makeWrapper ];
    buildPhase = ''
      # We need to provide the ghc interpreter (hint) with the location of the ghc lib dir and the package db
      mkdir -p $out/bin
      ln -s ${myGhc}/bin/hylide $out/bin/hylide
      wrapProgram $out/bin/hylide --set GHC_PACKAGE_PATH "${myGhc}/lib/${myGhc.meta.name}/package.conf.d"
      '';
    installPhase = "echo nothing to install";
  };

in

  hylide-invoker

We need a wrapper because of haskell-hint/hint#79, so that the hint repl that hylide uses internally can see the installation of hylogen and hylide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant