build(nix): import flake template

This commit is contained in:
Ananth Venkatesh 2025-01-24 22:07:53 -05:00
parent 7b8dc33f14
commit 96c2705531
Signed by: ananthv
GPG key ID: 4BB578E748CFE4FF
4 changed files with 264 additions and 0 deletions

55
flake.nix Normal file
View file

@ -0,0 +1,55 @@
{
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";
};
outputs =
{
self,
nixpkgs,
utils,
mkElmDerivation,
}:
utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
overlays = [ mkElmDerivation.overlays.mkElmDerivation ];
inherit system;
};
in
{
devShells.default =
with pkgs;
mkShell {
buildInputs = [
elmPackages.elm
elmPackages.elm-test
elmPackages.elm-format
];
};
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
'';
};
};
formatter = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
}
);
}