Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions cabal.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{ mkDerivation, aeson, async, base, data-default, directory
, filepath, lib, mtl, optics-core, profunctors, relude, shower
, time, with-utf8
}:
mkDerivation {
pname = "haskell-template";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
aeson async base data-default directory filepath mtl optics-core
profunctors relude shower time with-utf8
];
homepage = "https://srid.ca/haskell-template";
description = "A template for Haskell projects using Nix";
license = lib.licenses.mit;
mainProgram = "haskell-template";
}
12 changes: 6 additions & 6 deletions flake.lock

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

6 changes: 6 additions & 0 deletions nix/modules/flake-parts/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
(root + /haskell-template.cabal)
(root + /LICENSE)
(root + /README.md)
(root + /cabal.nix)
];
});

Expand All @@ -25,6 +26,11 @@

# Packages to add on top of `basePackages`
packages = {
# For IFD-less evaluation, you can point to pre-generated `cabal2nix` expression
# here for each package,
# haskell-flake will use this file to build the package.
# By default haskell-flake refers to `cabal.nix`
haskell-template.cabal2NixFile = config.pre-commit.settings.hooks.cabal2nix.settings.outputFilename;
# Add source or Hackage overrides here
# (Local packages are added automatically)
/*
Expand Down
10 changes: 9 additions & 1 deletion nix/modules/flake-parts/pre-commit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@
perSystem = { config, ... }: {
pre-commit.settings = {
hooks = {
nixpkgs-fmt.enable = true;
nixpkgs-fmt = {
enable = true;
# cabal2nix, nixpkgs-fmt both modifies default.nix, hence exlude fmt.
excludes = [ config.pre-commit.settings.hooks.cabal2nix.settings.outputFilename ];
};
cabal-fmt.enable = true;
fourmolu = {
enable = true;
package = config.fourmolu.wrapper;
};
hlint.enable = true;
cabal2nix = {
enable = true;
settings.outputFilename = "cabal.nix";
};
};
};

Expand Down