mirror of
https://github.com/grin-compiler/grin.git
synced 2024-09-11 07:25:28 +03:00
Use haskell.nix to keep stack and nix approaches in sync
This commit is contained in:
parent
70625b81d8
commit
a730ec167c
33
default.nix
33
default.nix
@ -1,24 +1,13 @@
|
||||
{ compiler ? "ghc865", pkgs ? import nix/pkgs.nix }:
|
||||
|
||||
let
|
||||
hlib = pkgs.haskell.lib;
|
||||
hpkg = pkgs.haskell.packages."${compiler}";
|
||||
llvm-hs = import ./nix/llvm-hs.nix;
|
||||
in
|
||||
|
||||
hpkg.developPackage {
|
||||
root = ./grin;
|
||||
overrides = self: super: {
|
||||
llvm-hs = hlib.dontCheck (self.callCabal2nix "llvm-hs" "${llvm-hs}/llvm-hs" {
|
||||
llvm-config = pkgs.llvm_7;
|
||||
});
|
||||
llvm-hs-pure = self.callCabal2nix "llvm-hs-pure" "${llvm-hs}/llvm-hs-pure" {};
|
||||
llvm-hs-pretty = self.callPackage ./nix/llvm-hs-pretty.nix {};
|
||||
haskell = import ./nix/haskell.nix;
|
||||
llvm-overlay = self: super: {
|
||||
llvm-config = self.llvm_7;
|
||||
};
|
||||
modifier = drv: hlib.addBuildTools drv [
|
||||
(import nix/llvm.nix {})
|
||||
pkgs.clang_7
|
||||
pkgs.llvm_7
|
||||
];
|
||||
returnShellEnv = false;
|
||||
}
|
||||
extra-overlays = [ llvm-overlay ];
|
||||
pkgs = import ./nix/packages.nix (haskell // {
|
||||
overlays = haskell.overlays ++ extra-overlays;
|
||||
});
|
||||
in
|
||||
pkgs.haskell-nix.stackProject {
|
||||
src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
|
||||
}
|
||||
|
7
nix/haskell-nix-src.json
Normal file
7
nix/haskell-nix-src.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"url": "https://github.com/input-output-hk/haskell.nix",
|
||||
"rev": "ebdc0030e6973629c1ed7dba53c1b1d154c3e75e",
|
||||
"date": "2019-12-11T01:12:46+00:00",
|
||||
"sha256": "1q25sw8kz7r0wwzq780qq1cgsiy1g7iwnywckixa28psim8rp2nw",
|
||||
"fetchSubmodules": false
|
||||
}
|
8
nix/haskell.nix
Normal file
8
nix/haskell.nix
Normal file
@ -0,0 +1,8 @@
|
||||
let
|
||||
spec = builtins.fromJSON (builtins.readFile ./haskell-nix-src.json);
|
||||
haskell-nix-src = builtins.fetchGit {
|
||||
name = "haskell-lib";
|
||||
inherit (spec) url rev;
|
||||
};
|
||||
in
|
||||
import haskell-nix-src
|
@ -1,19 +0,0 @@
|
||||
{ mkDerivation, array, base, bytestring, directory, filepath
|
||||
, llvm-hs, llvm-hs-pure, mtl, prettyprinter, tasty, tasty-golden
|
||||
, tasty-hspec, tasty-hunit, text, transformers, stdenv
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "llvm-hs-pretty";
|
||||
version = "0.6.1.0";
|
||||
sha256 = "12w1rkkaf50jl2vdkyk4xpvjmsxzjbfkdyklaq5p6b8ykw872pda";
|
||||
libraryHaskellDepends = [
|
||||
array base bytestring llvm-hs-pure prettyprinter text
|
||||
];
|
||||
testHaskellDepends = [
|
||||
base directory filepath llvm-hs llvm-hs-pure mtl tasty tasty-golden
|
||||
tasty-hspec tasty-hunit text transformers
|
||||
];
|
||||
description = "A pretty printer for LLVM IR";
|
||||
license = stdenv.lib.licenses.mit;
|
||||
hydraPlatforms = stdenv.lib.platforms.none;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
let
|
||||
url = "https://github.com/csabahruska/llvm-hs";
|
||||
ref = "llvm-7";
|
||||
rev = "868e23a13942703255979369defdb49ac57b6866";
|
||||
repo = builtins.fetchGit { inherit url ref rev; };
|
||||
in
|
||||
repo
|
@ -1,4 +1,4 @@
|
||||
{ pkgs ? import ./pkgs.nix }:
|
||||
{ pkgs ? import ./packages.nix {} }:
|
||||
|
||||
pkgs.runCommand
|
||||
"llvm-7-links"
|
||||
|
10
nix/packages.nix
Normal file
10
nix/packages.nix
Normal file
@ -0,0 +1,10 @@
|
||||
let
|
||||
commit = "4c6e9a553872366e485766fa8b574b54b15957f8";
|
||||
nixpkgs = builtins.fetchTarball {
|
||||
name = "nixpkgs-19.09";
|
||||
url = "https://github.com/nixos/nixpkgs/archive/${commit}.tar.gz";
|
||||
sha256 = "1az9yg2lwwfw3aypi6bdsk7ghld2963vqdp8ajkxciyxdfkaxb3b";
|
||||
};
|
||||
pkgs = import nixpkgs;
|
||||
in
|
||||
pkgs
|
@ -1,8 +0,0 @@
|
||||
let
|
||||
commit = "2adf2d615cf8f6c6be49a0e54dc9ebf551dcf70f";
|
||||
pinned = builtins.fetchTarball {
|
||||
name = "nixpkgs-19.09";
|
||||
url = "https://github.com/nixos/nixpkgs/archive/${commit}.tar.gz";
|
||||
sha256 = "0w8zgj38di4ssw6s0bxdb9rgksqfszsa3304863xic4bzsvkql9b";
|
||||
};
|
||||
in import pinned {}
|
22
shell.nix
22
shell.nix
@ -1,14 +1,12 @@
|
||||
{ pkgs ? import nix/pkgs.nix }:
|
||||
|
||||
let
|
||||
compiler = "ghc865";
|
||||
hpkg = pkgs.haskell.packages."${compiler}";
|
||||
grin = import ./. { inherit compiler pkgs; };
|
||||
pkgs = import ./nix/packages.nix {};
|
||||
llvm-links = import ./nix/llvm.nix { inherit pkgs; };
|
||||
haskellPkgs = import ./.;
|
||||
in
|
||||
|
||||
hpkg.shellFor {
|
||||
withHoogle = true;
|
||||
packages = p: [ grin ];
|
||||
buildInputs = with hpkg; [ cabal-install ghcid ];
|
||||
inherit (grin.env) nativeBuildInputs;
|
||||
}
|
||||
haskellPkgs.shellFor {
|
||||
buildInputs = with pkgs.haskellPackages; [
|
||||
llvm-links
|
||||
hlint
|
||||
ghcid
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user