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

Add stack 2.3.1 to shell.nix #1347

Merged
merged 1 commit into from
Feb 4, 2021

Conversation

smatting
Copy link
Contributor

@smatting smatting commented Jan 29, 2021

This adds the upstream static 2.3.1 build of stack to shell.nix.
I tested on linux that HLS from within shell.nix generates the same .cabal files as stack 2.3.1.

@jmatsushita
Copy link
Contributor

The principle works on OSX! Very nice. Except I have a forked shell.nix which includes the stack-deps.nix:

let
  sources = import ./nix/sources.nix;

  pkgs = import sources.nixpkgs { 
    overlays = [
      (import ./nix/overlays/wire-server.nix)
    ];
  };

  stack = with pkgs; stdenv.mkDerivation {
      pname = "stack";
      version = "2.3.1";

      
      src =
        if stdenv.isDarwin
        then fetchurl {
          url = "https://github.com/commercialhaskell/stack/releases/download/v2.3.1/stack-2.3.1-osx-x86_64.tar.gz";
          sha256 = "089nrb8mxf76a0r0hdccaxfvx1ly24b5zc0cy05gs4adybjygvkk";
        }
        else fetchurl {
          url = "https://github.com/commercialhaskell/stack/releases/download/v2.3.1/stack-2.3.1-linux-x86_64-static.tar.gz";
          sha256 = "0iqfqcd88rvlwgm2h8avs0rsi9f3pdxilvcacgrxskb1n8q8ibjb";
        };

      installPhase = ''
        mkdir -p $out/bin
        cp stack $out/bin
      '';
  };

in
with pkgs;
pkgs.mkShell {
  name = "shell";

  nativeBuildInputs = lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
    Cocoa
    CoreServices
  ]);

  buildInputs = (with pkgs; [
    cryptobox
    geoip
    git
    icu
    libsodium
    libxml2
    ncurses
    openssl
    pkgconfig
    protobuf
    pcre
    snappy
    zlib
    lzma
    docker-compose
    gnumake
    libiconv # Should make this Darwin only?
    haskell-language-server
  ]) ++ [ stack ] ;
   
  ghc = pkgs.haskell.compiler.ghc884;

}

Copy link
Contributor

@fisx fisx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmatsushita I'm not sure you're suggesting changes, but I think either way this is good to merge (you can always add changes later). yell if you disagree. :)

@smatting smatting merged commit 12607d9 into develop Feb 4, 2021
@smatting smatting deleted the smatting/2021-01-29-shell-stack-version branch February 4, 2021 13:47
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

Successfully merging this pull request may close these issues.

3 participants