Skip to content

Commit

Permalink
Merge pull request #56 from smunix/fix.devshell
Browse files Browse the repository at this point in the history
fix devshell + macosx builds
  • Loading branch information
luc-tielen authored Feb 21, 2022
2 parents e0a628b + 660c1e1 commit d4fd6e8
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 128 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ jobs:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest] # TODO fix macos support : [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/[email protected]
with:
# Nix Flakes doesn't work on shallow clones
fetch-depth: 0
- uses: cachix/install-nix-action@v15
with:
install_url: https://releases.nixos.org/nix/nix-2.5.1/install
install_url: https://releases.nixos.org/nix/nix-2.6.1/install
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
Expand Down
133 changes: 25 additions & 108 deletions flake.lock

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

33 changes: 17 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
description = "Souffle Datalog bindings for Haskell";
inputs = {
np.url = "github:nixos/nixpkgs?ref=haskell-updates";
np.url = "github:nixos/nixpkgs?ref=master";
fu.url = "github:numtide/flake-utils?ref=master";
hls.url = "github:haskell/haskell-language-server?ref=master";
ds.url = "github:numtide/devshell?ref=master";
};
outputs = { self, np, fu, hls }:
outputs = { self, np, fu, ds }:
with fu.lib;
eachSystem [ "x86_64-linux" "x86_64-darwin" ] (system:
let
Expand Down Expand Up @@ -38,7 +38,7 @@
${hlint}/bin/hlint ${souffle-haskell.src} -c
'';
};
overlays = [ overlay hls.overlay ];
overlays = [ overlay ds.overlay ];
in with (import np { inherit system config overlays; }); rec {
inherit overlays;
packages = flattenTree
Expand All @@ -47,17 +47,18 @@
apps = {
souffle-haskell-lint = mkApp { drv = souffle-haskell-lint; };
};
devShell = with haskellPackages;
shellFor {
packages = p: with p; [ hspec-discover packages.souffle-haskell ];
buildInputs = [
cabal-install
ghc
haskell-language-server
hspec-discover
souffle
souffle-haskell-lint
];
};
devShell = devshell.mkShell {
name = "SOUFFLE-HASKELL";
packages = with haskellPackages; [
cabal-install
ghc
haskell-language-server
hlint
hpack
hspec-discover
souffle
souffle-haskell-lint
];
};
});
}
9 changes: 7 additions & 2 deletions nix/souffle.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, cc ? 10, ... }:
{ pkgs, cc ? 11, ... }:

with pkgs;
lib.makeOverridable ({ stdenv ? (if pkgs.stdenv.isDarwin then
Expand All @@ -17,9 +17,14 @@ else
patches = [ ../patches/1-souffle-2.1-macosx.patch ];
cmakeFlags = [ "-DSOUFFLE_GIT=OFF" "-DSOUFFLE_BASH_COMPLETION=OFF" ];
ninjaFlags = [ "-v" ];
# LLVM uses -Werror but also runs clang on assembly files, which
# makes -fno-strict-overflow break the build.
hardeningDisable = [ "strictoverflow" ];
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "DESTINATION \''${BASH_COMPLETION_COMPLETIONSDIR}" "DESTINATION $out/share/completions/"
substituteInPlace CMakeLists.txt \
--replace "-fuse-ld=lld" "-fuse-ld=ld"
'';
postInstall = ''
wrapProgram "$out/bin/souffle" --prefix PATH : "${
Expand All @@ -28,7 +33,7 @@ else
'';
nativeBuildInputs = with pkgs;
[ bison cmake flex git mcpp makeWrapper ninja perl ]
++ (lib.optionals pkgs.stdenv.isLinux [ lsb-release ]);
++ (lib.optionals stdenv.isLinux [ lsb-release ]);
buildInputs = with pkgs; [ ncurses zlib sqlite libffi ];
propagatedBuildInputs = with pkgs; [ ncurses zlib sqlite libffi ];
outputs = [ "out" ];
Expand Down

0 comments on commit d4fd6e8

Please sign in to comment.