-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split flake.nix into various modules
This will be useful during `om init` to ignore the template itself for #120
- Loading branch information
Showing
4 changed files
with
109 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
perSystem = { config, pkgs, ... }: { | ||
# Auto formatters. This also adds a flake check to ensure that the | ||
# source tree was auto formatted. | ||
treefmt.config = { | ||
projectRootFile = "flake.nix"; | ||
|
||
programs.fourmolu = { | ||
enable = true; | ||
package = config.fourmolu.wrapper; | ||
}; | ||
programs.nixpkgs-fmt.enable = true; | ||
programs.cabal-fmt.enable = true; | ||
programs.hlint.enable = true; | ||
}; | ||
|
||
fourmolu.settings = { | ||
indentation = 2; | ||
comma-style = "leading"; | ||
record-brace-space = true; | ||
indent-wheres = true; | ||
import-export-style = "diff-friendly"; | ||
respectful = true; | ||
haddock-style = "multi-line"; | ||
newlines-between-decls = 1; | ||
extensions = [ "ImportQualifiedPost" ]; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ inputs, ... }: | ||
{ | ||
imports = [ | ||
inputs.haskell-flake.flakeModule | ||
]; | ||
perSystem = { self', lib, config, pkgs, ... }: { | ||
# Our only Haskell project. You can have multiple projects, but this template | ||
# has only one. | ||
# See https://github.com/srid/haskell-flake/blob/master/example/flake.nix | ||
haskellProjects.default = { | ||
# To avoid unnecessary rebuilds, we filter projectRoot: | ||
# https://community.flake.parts/haskell-flake/local#rebuild | ||
projectRoot = builtins.toString (lib.fileset.toSource { | ||
root = ../..; | ||
fileset = lib.fileset.unions [ | ||
../../src | ||
../../haskell-template.cabal | ||
../../LICENSE | ||
../../README.md | ||
]; | ||
}); | ||
|
||
# The base package set (this value is the default) | ||
# basePackages = pkgs.haskellPackages; | ||
|
||
# Packages to add on top of `basePackages` | ||
packages = { | ||
# Add source or Hackage overrides here | ||
# (Local packages are added automatically) | ||
/* | ||
aeson.source = "1.5.0.0" # Hackage version | ||
shower.source = inputs.shower; # Flake input | ||
*/ | ||
}; | ||
|
||
# Add your package overrides here | ||
settings = { | ||
/* | ||
haskell-template = { | ||
haddock = false; | ||
}; | ||
aeson = { | ||
check = false; | ||
}; | ||
*/ | ||
}; | ||
|
||
# Development shell configuration | ||
devShell = { | ||
hlsCheck.enable = false; | ||
}; | ||
|
||
# What should haskell-flake add to flake outputs? | ||
autoWire = [ "packages" "apps" "checks" ]; # Wire all but the devShell | ||
}; | ||
|
||
# Default package & app. | ||
packages.default = self'.packages.haskell-template; | ||
apps.default = self'.apps.haskell-template; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ inputs, ... }: | ||
|
||
{ | ||
imports = [ | ||
inputs.treefmt-nix.flakeModule | ||
inputs.fourmolu-nix.flakeModule | ||
]; | ||
flake.templates.default = { | ||
description = "A batteries-included Haskell project template for Nix"; | ||
path = builtins.path { path = inputs.self; }; | ||
}; | ||
} |