8000 fix nix-shell, nix-build by smunix · Pull Request #378 · llvm-hs/llvm-hs · GitHub
[go: up one dir, main page]

Skip to content

fix nix-shell, nix-build #378

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

Open
wants to merge 5 commits into
base: llvm-9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
llvm: add ghc902
  • Loading branch information
smunix committed Dec 30, 2021
commit c99da1eb64dc38c69638a78032ad8d9fd338715f
3 changes: 3 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
src = builtins.fetchGit ./.;
}).defaultNix
196 changes: 196 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
description = "General purpose LLVM bindings";
inputs = {
np.url = "github:nixos/nixpkgs?ref=haskell-updates";
fu.url = "github:numtide/flake-utils?ref=master";
nf.url = "github:numtide/nix-filter?ref=master";
hls.url = "github:haskell/haskell-language-server?ref=master";
};
outputs = { self, np, fu, nf, hls }:
with fu.lib;
eachSystem [ "x86_64-linux" ] (system:
let
version = ghc:
with np.lib;
"${ghc}-${substring 0 8 self.lastModifiedDate}.${
self.shortRev or "dirty"
}";
config = { };
mkOverlay = ghc: final: _:
with final;
with haskell.packages."ghc${ghc}".extend (final: _:
with final;
with haskell.lib; {
llvm-hs-pure = overrideCabal (callCabal2nix "llvm-hs-pure"
(with nf.lib; filter { root = ./llvm-hs-pure; }) { })
(o: { version = "${o.version}-${version ghc}"; });
llvm-hs = overrideCabal (callCabal2nix "llvm-hs"
(with nf.lib; filter { root = ./llvm-hs; }) {
inherit llvm-hs-pure;
llvm-config = llvmPackages_9.llvm;
}) (o: { version = "${o.version}-${version ghc}"; });
}); {
"llvm-hs-pure-${ghc}" = llvm-hs;
"llvm-hs-${ghc}" = llvm-hs-pure;
};
mkOverlays = ghcs: map mkOverlay ghcs;
eachGHC = ghcs:
let
pkgs = (import np {
inherit config system;
overlays = (mkOverlays ghcs);
});
in with pkgs;
with builtins; rec {
inherit (pkgs) overlays;
packages = flattenTree (recurseIntoAttrs (with lib.lists;
foldr (ghc: s:
{
"llvm-hs-${ghc}" = getAttr "llvm-hs-${ghc}" pkgs;
"llvm-hs-pure-${ghc}" = getAttr "llvm-hs-pure-${ghc}" pkgs;
} // s) { } ghcs));
};
in eachGHC [ "902" "8107" ]);
}
13 changes: 13 additions & 0 deletions hie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cradle:
cabal:
- path: "./llvm-hs/src"
component: "lib:llvm-hs"

- path: "./llvm-hs/test"
component: "llvm-hs:test:test"

- path: "./llvm-hs-pure/src"
component: "lib:llvm-hs-pure"

- path: "./llvm-hs-pure/test"
component: "llvm-hs-pure:test:test"
36 changes: 3 additions & 33 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
let
default_nixpkgs = (import <nixpkgs> {}).fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "d587092e9e7df9786495c19f710cf6469d72eecb";
sha256 = "1ygabmi2lmgy93a1zlmd7hw4ky83rjb6hn6ji40pj8flb437b8c4";
};
in

{ nixpkgs ? default_nixpkgs
, compiler ? "ghc881" }:
let
hsOverlay = self: super: {
llvm_9 = (super.llvm_9.override { debugVersion = true; }).overrideAttrs(_: { doCheck = false; });
haskell = super.haskell // {
packages = super.haskell.packages // {
"${compiler}" = super.haskell.packages."${compiler}".override {
overrides = haskellSelf: haskellSuper: {
llvm-hs = haskellSuper.callCabal2nix "llvm-hs" ./llvm-hs { llvm-config = self.llvm_9; };
llvm-hs-pure = haskellSuper.callCabal2nix "llvm-hs-pure" ./llvm-hs-pure {};
};
};
};
};
};

orig_pkgs = import nixpkgs {};
pkgs = import orig_pkgs.path { overlays = [ hsOverlay ]; };
in
pkgs.haskell.packages."${compiler}".shellFor {
packages = pkgs: with pkgs; [llvm-hs llvm-hs-pure];
nativeBuildInputs = with pkgs; [ llvm_9 gdb lldb ];
}
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
src = builtins.fetchGit ./.;
}).shellNix
0