Skip to content

Commit

Permalink
Profiling build of inferno binary (#20)
Browse files Browse the repository at this point in the history
This adds a profiling build of the inferno binary, which can be used via

```
nix shell .#inferno-core:exe:inferno-ghc924-prof
```

However, I've had to update `haskell.nix`, as the profiling build needs
`recursion-schemes` >=5.2.2.3, due to:

> Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/18320,
which was preventing code calling makeBaseFunctor from being profiled.

The update to `haskell.nix` seems to have broken the dev shell??

Co-authored-by: Rory Tyler Hayford <[email protected]>
  • Loading branch information
goodlyrottenapple and ngua authored Jan 9, 2023
1 parent 21c19e2 commit 552fd3f
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 41 deletions.
58 changes: 46 additions & 12 deletions flake.lock

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

72 changes: 44 additions & 28 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,43 +88,59 @@
compiler
# TODO
# Do we want to enable any `crossPlatforms` here?
((infernoFor compiler pkgs).flake { })
((infernoFor { inherit compiler pkgs; }).flake { })
) ++
lib.lists.forEach [ defaultCompiler ]
(compiler: lib.attrsets.nameValuePair
(compiler + "-prof")
((infernoFor {
inherit compiler pkgs;
profiling = true;
ghcOptions = [ "-eventlog" ];
}).flake { })
)
);

# This should be parameterized by the `pkgs` used to build the project. We
# want users who get packages from our `overlays.default` to be able to
# use their own `nixpkgs` without having to instantiate ours as well
# (which would happen if we just use `self.packages` directly in the overlay)
infernoFor = compiler: pkgs: pkgs.haskell-nix.cabalProject {
name = "inferno";
compiler-nix-name = compiler;
src = builtins.path {
path = ./.;
filter = path: type:
builtins.any
(ext: baseNameOf path != ext)
[ ".nix" ".md" ];
};
shell = {
withHoogle = true;
tools = {
cabal = { };
haskell-language-server = { };
infernoFor = { compiler, pkgs, ghcOptions ? [ ], profiling ? false }:
pkgs.haskell-nix.cabalProject {
name = "inferno";
compiler-nix-name = compiler;
src = builtins.path {
path = ./.;
filter = path: type:
builtins.any
(ext: baseNameOf path != ext)
[ ".nix" ".md" ];
};
buildInputs = [ pkgs.nixpkgs-fmt ] ++
# ormolu build currently segfaults on the M1
lib.optional (pkgs.system != "aarch64-darwin") (ormoluFor compiler pkgs);
};
modules = [
{
packages = {
# This takes forever to build
ghc.components.library.doHaddock = false;
shell = {
withHoogle = true;
tools = {
cabal = { };
haskell-language-server = { };
};
}
];
};
buildInputs = [ pkgs.nixpkgs-fmt ] ++
# ormolu build currently segfaults on the M1
lib.optional (pkgs.system != "aarch64-darwin") (ormoluFor compiler pkgs);
};
modules = [
{
enableLibraryProfiling = profiling;
packages = {
# This takes forever to build
ghc.components.library.doHaddock = false;
};
packages.inferno-core = {
enableLibraryProfiling = profiling;
enableProfiling = profiling;
inherit ghcOptions;
};
}
];
};

# Get the same version of `ormolu` everywhere, including the shell
ormoluFor = compiler: pkgs: pkgs.haskell-nix.tool
Expand Down
2 changes: 1 addition & 1 deletion inferno-types/inferno-types.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ library
, QuickCheck >= 2.14.2 && < 2.15
, quickcheck-arbitrary-adt >= 0.3.1 && < 0.4
, quickcheck-instances >= 0.3.28 && < 0.4
, recursion-schemes >= 5.2.2 && < 5.3
, recursion-schemes >= 5.2.2.3 && < 5.3
, servant >= 0.19 && < 0.20
, text >= 2.0.1 && < 2.1
default-language: Haskell2010
Expand Down

0 comments on commit 552fd3f

Please sign in to comment.