2021-05-31 23:19:51 +00:00
|
|
|
{
|
2021-06-01 02:46:25 +00:00
|
|
|
description = "haskell-template's description";
|
2021-05-31 23:19:51 +00:00
|
|
|
inputs = {
|
2022-03-23 17:52:08 +00:00
|
|
|
# To find a suitable nixpkgs hash with cache, pick one from https://status.nixos.org/
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/1ec61dd4167f04be8d05c45780818826132eea0d";
|
2021-05-31 23:19:51 +00:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2022-02-21 00:19:39 +00:00
|
|
|
flake-utils.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
flake-compat.url = "github:edolstra/flake-compat";
|
|
|
|
flake-compat.flake = false;
|
|
|
|
flake-compat.inputs.nixpkgs.follows = "nixpkgs";
|
2022-03-25 18:09:08 +00:00
|
|
|
lint-utils = {
|
|
|
|
type = "git";
|
|
|
|
url = "https://gitlab.homotopic.tech/nix/lint-utils.git";
|
|
|
|
ref = "lc/fourmolu";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2021-05-31 23:19:51 +00:00
|
|
|
};
|
|
|
|
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
|
2022-03-23 17:39:20 +00:00
|
|
|
flake-utils.lib.eachDefaultSystem
|
|
|
|
(system:
|
|
|
|
let
|
|
|
|
# Because: https://zimbatm.com/notes/1000-instances-of-nixpkgs
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
2022-03-17 14:16:54 +00:00
|
|
|
|
2022-03-23 17:39:20 +00:00
|
|
|
# Change GHC version here. To get the appropriate value, run:
|
|
|
|
# nix-env -f "<nixpkgs>" -qaP -A haskell.compiler
|
|
|
|
hp = pkgs.haskellPackages; # pkgs.haskell.packages.ghc921;
|
2022-03-17 14:16:54 +00:00
|
|
|
|
2022-03-23 17:39:20 +00:00
|
|
|
project = returnShellEnv:
|
|
|
|
hp.developPackage {
|
|
|
|
inherit returnShellEnv;
|
|
|
|
name = "haskell-template";
|
|
|
|
root = ./.;
|
|
|
|
withHoogle = false;
|
|
|
|
overrides = self: super: with pkgs.haskell.lib; {
|
|
|
|
# Use callCabal2nix to override Haskell dependencies here
|
|
|
|
# cf. https://tek.brick.do/K3VXJd8mEKO7
|
|
|
|
# Example:
|
|
|
|
# > NanoID = self.callCabal2nix "NanoID" inputs.NanoID { };
|
|
|
|
# Assumes that you have the 'NanoID' flake input defined.
|
|
|
|
};
|
|
|
|
modifier = drv:
|
|
|
|
pkgs.haskell.lib.addBuildTools drv (with hp; pkgs.lib.lists.optionals returnShellEnv [
|
|
|
|
# Specify your build/dev dependencies here.
|
|
|
|
cabal-fmt
|
|
|
|
cabal-install
|
|
|
|
ghcid
|
|
|
|
haskell-language-server
|
2022-03-23 17:46:51 +00:00
|
|
|
fourmolu
|
2022-03-23 17:39:20 +00:00
|
|
|
hlint
|
|
|
|
pkgs.nixpkgs-fmt
|
|
|
|
]);
|
2021-05-31 23:19:51 +00:00
|
|
|
};
|
2022-03-23 17:39:20 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
# Used by `nix build` & `nix run` (prod exe)
|
|
|
|
defaultPackage = project false;
|
2021-05-31 23:19:51 +00:00
|
|
|
|
2022-03-25 18:09:08 +00:00
|
|
|
apps = {
|
|
|
|
format = inputs.lint-utils.apps.${system}.fourmoluStandard8107;
|
|
|
|
};
|
|
|
|
|
2022-03-23 17:39:20 +00:00
|
|
|
# Used by `nix develop` (dev shell)
|
|
|
|
devShell = project true;
|
|
|
|
}) // {
|
|
|
|
# For hercules-CI support,
|
|
|
|
# https://docs.hercules-ci.com/hercules-ci/guides/upgrade-to-agent-0.9/#_upgrade_your_repositories
|
|
|
|
herculesCI.ciSystems = [ "x86_64-linux" ];
|
|
|
|
};
|
2021-05-31 23:19:51 +00:00
|
|
|
}
|