hakyll-skeleton/outputs.nix
2024-10-29 00:27:40 +10:00

75 lines
1.8 KiB
Nix

{
self,
nixpkgs,
utils,
haskellNix,
} @ inputs:
utils.lib.eachDefaultSystem (
system: let
overlays = [
haskellNix.overlay
(final: prev: {
hakyllProject = final.haskell-nix.project' {
src = ./.;
compiler-nix-name = "ghc910";
shell.buildInputs = [
skeleton-web
];
shell.tools = {
cabal = "latest";
hlint = "latest";
haskell-language-server = "latest";
};
};
})
];
pkgs = import nixpkgs {
inherit overlays system;
inherit (haskellNix) config;
};
flake = pkgs.hakyllProject.flake {};
skeleton-web = flake.packages."skeleton-web:exe:site";
hakyll-skeleton = pkgs.stdenv.mkDerivation {
name = "hakyll-skeleton";
buildInputs = [];
src =
pkgs.nix-gitignore.gitignoreSourcePure [
./.gitignore
".git"
".github"
]
./.;
# LANG and LOCALE_ARCHIVE are fixes pulled from the community:
LANG = "en_AU.UTF-8";
LOCALE_ARCHIVE =
pkgs.lib.optionalString
(pkgs.buildPlatform.libc == "glibc")
"${pkgs.glibcLocales}/lib/locale/locale-archive";
buildPhase = ''
${skeleton-web}/bin/site build --verbose
'';
installPhase = ''
cp -a _site/. "$out/"
'';
};
in {
packages = {
inherit skeleton-web hakyll-skeleton;
default = hakyll-skeleton;
};
apps = {
default = utils.lib.mkApp {
drv = skeleton-web;
exePath = "/bin/skeleton-web";
};
};
# Overwrite devShells being inported from haskell-nix
devShells.default = pkgs.callPackage ./shell.nix {
inherit (haskellNix.legacyPackages."${pkgs.system}") stylish-haskell;
};
}
)