Skip to content

Instantly share code, notes, and snippets.

@jhenahan
Last active January 3, 2021 05:21
Show Gist options
  • Save jhenahan/6404434999995070fde2765c8c586b27 to your computer and use it in GitHub Desktop.
Save jhenahan/6404434999995070fde2765c8c586b27 to your computer and use it in GitHub Desktop.
Haskell + Emacs + LSP + Nix
packages: ./*.cabal
jobs: $ncpus
optimization: 2
executable-stripping: True
documentation: True
haddock-html-location: https://hackage.haskell.org/packages/archive/$pkg/$version/doc/html
haddock-hyperlink-source: true
{ sources ? import ./nix/sources.nix
, haskellNix ? import sources."haskell.nix" {}
, nixpkgsSrc ? haskellNix.sources.nixpkgs-2009
, compiler ? "ghc8102" }:
let
overlays = haskellNix.nixpkgsArgs.overlays;
pkgs = import nixpkgsSrc {
inherit overlays;
inherit (haskellNix.nixpkgsArgs) config;
};
in pkgs.haskell-nix.cabalProject {
compiler-nix-name = compiler;
src = pkgs.haskell-nix.haskellLib.cleanGit {
name = "your-project-name";
src = ./.;
};
}
cradle:
multi:
- path: ./Setup.hs
config:
cradle:
direct:
arguments:
- "-package Cabal"
- "-package base"
- path: "./"
config:
cradle:
cabal:
- path: "src"
component: "lib:your-project-name"
- path: "app/Main.hs"
component: "your-project-name:exe:example"
- path: "test"
component: "your-project-name:test:example-test"
substituters = https://cache.nixos.org https://nix-tools.cachix.org https://hercules-ci.cachix.org https://hydra.iohk.io https://cache.dhall-lang.org https://dhall.cachix.org https://cache.nixos.org/ https://srid.cachix.org https://nix-community.cachix.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-tools.cachix.org-1:ebBEBZLogLxcCvipq2MTvuHlP7ZRdkazFSQsbs0Px1A= hercules-ci.cachix.org-1:ZZeDl9Va+xe9j+KqdzoBZMFJHVQ42Uu/c/1/KMC5Lw0= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.dhall-lang.org:I9/H18WHd60olG5GsIjolp7CtepSgJmM2CsO813VTmM= dhall.cachix.org-1:8laGciue2JBwD49ICFtg+cIF8ddDaW7OFBjDb/dHEAo= srid.cachix.org-1:MTQ6ksbfz3LBMmjyPh0PLmos+1x+CdtJxA/J2W+PQxI= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs
let hsPkgs = import ./default.nix { };
in hsPkgs.shellFor {
packages = ps: [ ps.your-project-name ];
withHoogle = true;
tools = import ./tools.nix;
}
{
cabal = "3.2.0.0";
haskell-language-server = "latest";
hlint = "3.2.3";
fourmolu = "0.3.0.0";
ormolu = "0.1.4.1";
weeder = "2.1.2";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment