Skip to content

Commit

Permalink
Haskell dependencies via Nix (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
int-index authored Nov 4, 2019
1 parent ef75e75 commit ac7ae91
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 207 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ MAlonzo

# Sdam
*.sd

# Nix
result
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
language: nix
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ Implementation status:
## Getting Started

```
$ nix-shell
$ cabal v2-update
$ cabal v2-build morte-to-sdam
$ cabal v2-run -v0 -- morte-to-sdam "./expr.morte" > expr.sd
$ cabal v2-run -- foundry expr.sd
$ nix-build
$ result/bin/morte-to-sdam "./expr.morte" > expr.sd
$ result/bin/foundry expr.sd
```
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
echo $FILES
ormolu -c --mode check $FILES
displayName: 'Check formatting'
- job: Linux
- job: Ubuntu
pool:
vmImage: 'ubuntu-16.04'
steps:
Expand Down
169 changes: 0 additions & 169 deletions cabal.project.freeze

This file was deleted.

99 changes: 99 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
let

nixpkgsPin = import ./nix/nixpkgs-pin.nix;

in

{ pkgs ? import (builtins.fetchTarball nixpkgsPin) {},
hc ? "ghc865"
}:

let

sdam_from_github =
pkgs.fetchFromGitHub {
owner = "int-index";
repo = "sdam";
rev = "9e79a6f589921a8a0e05119dcf5711af2dddbca2";
sha256 = "0g8kam2fg99frdc27snqpgphc1w0bag3jrxivb6qkxk8pg114zgq";
};

slay_from_github =
pkgs.fetchFromGitHub {
owner = "int-index";
repo = "slay";
rev = "69b533004637319c2f210dfb17f44acfce3f59d2";
sha256 = "1bdh7p81a1w4y8c4rmq3knwjm10zxclx5lif4bs407ahfrsfi600";
};

morte_1_7_2 =
pkgs.fetchFromGitHub {
owner = "Gabriel439";
repo = "Haskell-Morte-Library";
rev = "f7a459c7ec1d69f71c389f5693a26a94c1854636";
sha256 = "186mysp5f3mpd2mzgba2rfs5hlccf5whdi4gcr317zk82aqlzwrz";
};

haskell_inputs = p: [
p.gtk3
p.lens
p.dlist
p.ghc-lib-parser
p.megaparsec
p.inj
p.inj-base
p.regex-applicative
p.split
p.streams
p.sdam
p.slay-core
p.slay-combinators
p.slay-cairo
p.morte
];

haskellPackages =
pkgs.haskell.packages.${hc}.override {
overrides = self: super: rec {
sdam = self.callCabal2nix "sdam" sdam_from_github {};
slay-core = self.callCabal2nix "slay-core" "${slay_from_github}/core" {};
slay-combinators = self.callCabal2nix "slay-combinators" "${slay_from_github}/combinators" {};
slay-cairo = self.callCabal2nix "slay-cairo" "${slay_from_github}/cairo" {};
morte = self.callCabal2nix "morte" morte_1_7_2 {};
};
};

in

pkgs.stdenv.mkDerivation rec {
name = "foundry";
src = ./.;
buildCommand = ''
mkdir -p $out/bin $out/home
cp -r $src/foundry.cabal $src/lib $src/src .
HOME=$out/home \
cabal --offline --config-file /dev/null v2-install \
--builddir=$out/dist \
--installdir=$out/bin \
exe:foundry exe:morte-to-sdam exe:hask exe:haskell-to-sdam
'';
buildInputs = [
(haskellPackages.ghcWithPackages haskell_inputs)
pkgs.cabal-install
pkgs.git
pkgs.zlib
pkgs.pkgconfig
pkgs.cairo
pkgs.pango
pkgs.gtk3
pkgs.which # for CI
];
shellHook = ''
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath buildInputs}:$LD_LIBRARY_PATH
export LANG=en_US.UTF-8
'';
LOCALE_ARCHIVE =
if pkgs.stdenv.isLinux
then "${pkgs.glibcLocales}/lib/locale/locale-archive"
else "";
}
32 changes: 0 additions & 32 deletions shell.nix

This file was deleted.

0 comments on commit ac7ae91

Please sign in to comment.