ormolu/default.nix
mrkkrp a3a93ebfef Refactor the comment rendering code and ‘newline’
This removes (or rather puts it to a lower level) logic around “modifying
newline” because it was very hard to reason about and almost blocked my work
on fixing issue #337.

I also dropped debugging output because it's too verbose and I'm not using
it anyway.

As part of these changes I also changed now the ‘newline’ combinator works.
Now, similar to ‘space’, the second ‘newline’ in a row just tells the
rendering engine to prefix next thing with a newline, using the ‘newline’
combinator more than twice in a row has no effect.

To take full advantage of the new feature I also went through the code and
simplified some logic around outputting exact amount of newlines because now
it's harder to get things wrong, so we can be less careful with counting
newlines.
2019-09-05 16:56:43 +02:00

82 lines
1.7 KiB
Nix

{ pkgs ? (import ./nix/nixpkgs) }:
let
ormoluCompiler = "ghc865";
source = pkgs.lib.sourceByRegex ./.[
"^.*\.md$"
"^app.*$"
"^data.*$"
"^ormolu.cabal$"
"^src.*$"
"^tests.*$"
];
haskellPackages = pkgs.haskell.packages.${ormoluCompiler}.override {
overrides = ormoluOverlay;
};
ormoluOverlay = self: super: {
"ormolu" = super.callCabal2nix "ormolu" source { };
};
ormolize = import ./nix/ormolize {
inherit pkgs;
inherit haskellPackages;
};
ormolizedPackages = doCheck:
pkgs.lib.mapAttrs (_: v: ormolize { package = v; inherit doCheck; }) haskellPackages;
in {
ormolu = haskellPackages.ormolu;
ormoluShell = haskellPackages.shellFor {
packages = ps: [ ps.ormolu ];
buildInputs = [ haskellPackages.cabal-install haskellPackages.ghcid ];
};
inherit ormoluOverlay ormoluCompiler;
hackage = ormolizedPackages false;
hackageTests = with pkgs.lib; pkgs.recurseIntoAttrs (
let ps = [
"QuickCheck"
"ShellCheck"
"aeson"
"attoparsec"
"aws"
"cassava"
"conduit"
"cryptonite"
"diagrams-core"
"distributed-process"
"esqueleto"
"fay"
"haxl"
"hedgehog"
"hlint"
"megaparsec"
"ormolu"
"postgrest"
"servant"
"servant-server"
"tensorflow"
"yesod-core"
# Comment idempotence issue
# "Agda"
# "brick"
# "hakyll"
# "hledger"
# "http-client"
# "idris"
# "intero"
# "leksah"
# "pandoc"
# "pipes"
# "stack"
# "tls"
# Missing language extension
# "lens" #fixed in master
# "purescript"
];
in listToAttrs (map (p: nameValuePair p (ormolizedPackages true).${p}) ps)
);
}