Initial commit
This commit is contained in:
commit
cf2af11b6b
23 changed files with 3988 additions and 0 deletions
76
flake.nix
Normal file
76
flake.nix
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
description = "Advent-Of-Code";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
||||
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, pre-commit-hooks }:
|
||||
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
||||
overlay = final: prev: { aoc = final.callCabal2nix "aoc" ./. { }; };
|
||||
|
||||
haskellPackages = pkgs.haskell.packages.ghc942.extend overlay;
|
||||
in {
|
||||
packages.default = haskellPackages.aoc;
|
||||
|
||||
apps = {
|
||||
# run with: nix run #.aoc
|
||||
aoc = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.default}/bin/aoc";
|
||||
};
|
||||
|
||||
# run with: nix run
|
||||
default = self.apps.${system}.aoc;
|
||||
};
|
||||
|
||||
checks = {
|
||||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
settings = { ormolu.defaultExtensions = [ "GHC2021" ]; };
|
||||
tools.fourmolu = haskellPackages.fourmolu;
|
||||
hooks = {
|
||||
nixfmt.enable = true;
|
||||
fourmolu.enable = true;
|
||||
hpack.enable = true;
|
||||
hlint.enable = true;
|
||||
doctest = {
|
||||
enable = false;
|
||||
name = "Run documentation tests";
|
||||
entry = "${haskellPackages.doctest}/bin/doctest src app";
|
||||
files = "\\.l?hs$";
|
||||
pass_filenames = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
devShells.default = haskellPackages.shellFor {
|
||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||
|
||||
packages = p: [ p.aoc ];
|
||||
|
||||
withHoogle = true;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
haskellPackages.haskell-language-server
|
||||
haskellPackages.fourmolu
|
||||
haskellPackages.hspec-discover
|
||||
haskellPackages.doctest
|
||||
cabal-install
|
||||
ghcid
|
||||
nixfmt
|
||||
hpack
|
||||
hlint
|
||||
];
|
||||
};
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue