1
1
mirror of https://github.com/nmattia/niv.git synced 2024-11-07 22:36:53 +03:00

Add ormolu to dev environment

Closes #221
This commit is contained in:
Ben Sima 2020-05-01 08:49:44 -07:00 committed by Nicolas Mattia
parent 3c7cecd8e6
commit 6bb2a97db7
4 changed files with 35 additions and 1 deletions

View File

@ -147,7 +147,10 @@ with rec
# version from `package.yaml` and create a dummy module that we inject in the # version from `package.yaml` and create a dummy module that we inject in the
# `ghci` command. # `ghci` command.
niv-devshell = haskellPackages.shellFor { niv-devshell = haskellPackages.shellFor {
buildInputs = [ pkgs.nixpkgs-fmt ]; buildInputs = [
pkgs.nixpkgs-fmt
pkgs.ormolu
];
packages = ps: [ ps.niv ]; packages = ps: [ ps.niv ];
shellHook = '' shellHook = ''
repl_for() { repl_for() {

View File

@ -1,9 +1,14 @@
{ sources ? import ./sources.nix }: { sources ? import ./sources.nix }:
let
ormoluCompiler = "ghc865";
in
import sources.nixpkgs { import sources.nixpkgs {
overlays = [ overlays = [
(_: pkgs: { inherit sources; }) (_: pkgs: { inherit sources; })
(_: pkgs: { nixpkgs-fmt = import pkgs.sources.nixpkgs-fmt {}; }) (_: pkgs: { nixpkgs-fmt = import pkgs.sources.nixpkgs-fmt {}; })
(_: pkgs: { termtosvg = pkgs.callPackage ./termtosvg.nix {}; }) (_: pkgs: { termtosvg = pkgs.callPackage ./termtosvg.nix {}; })
(import ./haskell-overlay.nix { inherit ormoluCompiler; })
(_: pkgs: { ormolu = pkgs.haskell.packages."${ormoluCompiler}".ormolu; })
]; ];
config = {}; config = {};
} }

14
nix/haskell-overlay.nix Normal file
View File

@ -0,0 +1,14 @@
{ ormoluCompiler }: self: super:
let
ormolu = import super.sources.ormolu { pkgs = self; inherit ormoluCompiler; };
in
{
haskell = super.haskell // {
packages = super.haskell.packages // {
"${ormolu.ormoluCompiler}" = super.haskell.packages.${ormolu.ormoluCompiler}.override {
overrides = ormolu.ormoluOverlay;
};
};
};
}

View File

@ -23,6 +23,18 @@
"url": "https://github.com/nix-community/nixpkgs-fmt/archive/2a64f4b6a597d0d62004ffcec3ae4fd83cd1efc8.tar.gz", "url": "https://github.com/nix-community/nixpkgs-fmt/archive/2a64f4b6a597d0d62004ffcec3ae4fd83cd1efc8.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}, },
"ormolu": {
"branch": "master",
"description": "A formatter for Haskell source code",
"homepage": null,
"owner": "tweag",
"repo": "ormolu",
"rev": "22839ed74c9964578ae3b2af5c693f605ac8a687",
"sha256": "055z8p8kl80fr50crcvy2djk3qg2x34p8pa7kihxlcj9wrhsijyy",
"type": "tarball",
"url": "https://github.com/tweag/ormolu/archive/22839ed74c9964578ae3b2af5c693f605ac8a687.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"termtosvg": { "termtosvg": {
"branch": "develop", "branch": "develop",
"description": "Record terminal sessions as SVG animations", "description": "Record terminal sessions as SVG animations",