macgregor/flake.nix

74 lines
1.9 KiB
Nix
Raw Normal View History

2025-01-25 03:07:53 +00:00
{
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";
2025-02-01 08:42:40 +00:00
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
2025-01-25 03:07:53 +00:00
};
outputs =
{
self,
nixpkgs,
utils,
mkElmDerivation,
2025-02-01 08:42:40 +00:00
pre-commit-hooks,
2025-01-25 03:07:53 +00:00
}:
utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
overlays = [ mkElmDerivation.overlays.mkElmDerivation ];
inherit system;
};
in
{
devShells.default =
with pkgs;
mkShell {
2025-02-01 08:42:40 +00:00
inherit (self.checks.${system}.pre-commit-check) shellHook;
buildInputs = self.checks.${system}.pre-commit-check.enabledPackages ++ [
2025-01-25 03:07:53 +00:00
elmPackages.elm
elmPackages.elm-test
elmPackages.elm-format
2025-02-01 08:42:40 +00:00
elmPackages.elm-review
entr
2025-01-25 03:07:53 +00:00
];
};
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
'';
};
};
2025-02-01 08:42:40 +00:00
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;
};
};
};
2025-01-25 03:07:53 +00:00
formatter = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
}
);
}