reciproka-web/outputs.nix
2024-10-29 23:00:14 +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 = [
reciproka-web
];
shell.tools = {
cabal = "latest";
hlint = "latest";
haskell-language-server = "latest";
};
};
})
];
pkgs = import nixpkgs {
inherit overlays system;
inherit (haskellNix) config;
};
flake = pkgs.hakyllProject.flake {};
reciproka-web = flake.packages."reciproka-web:exe:site";
reciproka-net = pkgs.stdenv.mkDerivation {
name = "reciproka-net";
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 = ''
${reciproka-web}/bin/site build --verbose
'';
installPhase = ''
cp -a _site/. "$out/"
'';
};
in {
packages = {
inherit reciproka-web reciproka-net;
default = reciproka-net;
};
apps = {
default = utils.lib.mkApp {
drv = reciproka-web;
exePath = "/bin/reciproka-web";
};
};
# Overwrite devShells being inported from haskell-nix
devShells.default = pkgs.callPackage ./shell.nix {
inherit (haskellNix.legacyPackages."${pkgs.system}") stylish-haskell;
};
}
)