{ description = "Flake for building the MacGregor House website"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; utils.url = "github:numtide/flake-utils"; mkElmDerivation.url = "github:jeslie0/mkElmDerivation"; pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; }; outputs = { self, nixpkgs, utils, mkElmDerivation, pre-commit-hooks, }: utils.lib.eachDefaultSystem ( system: let pkgs = import nixpkgs { overlays = [ mkElmDerivation.overlays.mkElmDerivation ]; inherit system; }; in { devShells.default = with pkgs; mkShell { inherit (self.checks.${system}.pre-commit-check) shellHook; buildInputs = self.checks.${system}.pre-commit-check.enabledPackages ++ [ elmPackages.elm elmPackages.elm-test elmPackages.elm-format elmPackages.elm-review entr ]; }; packages = { default = pkgs.mkElmDerivation { name = "macgregor"; src = ./.; elmJson = ./elm.json; nativeBuildInputs = [ pkgs.elmPackages.elm ]; buildPhase = '' elm make src/Main.elm --output Main.js --optimize ''; installPhase = '' mkdir $out cp Main.js $out ''; }; }; checks = { pre-commit-check = pre-commit-hooks.lib.${system}.run { src = ./.; hooks = { nixfmt-rfc-style.enable = true; elm-format.enable = true; # elm-review.enable = true; # elm-test.enable = true; }; }; }; formatter = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style; } ); }