fix: entire build
This commit is contained in:
parent
90a5ead5d2
commit
8ada566a8e
10 changed files with 997 additions and 123 deletions
109
flake.nix
109
flake.nix
|
@ -1,48 +1,93 @@
|
|||
{
|
||||
description = "hakyll-nix-template";
|
||||
|
||||
nixConfig.bash-prompt = "[nix]λ ";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-21.05";
|
||||
|
||||
flake-utils = {
|
||||
url = "github:numtide/flake-utils";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixConfig = {
|
||||
allow-import-from-derivation = "true";
|
||||
bash-prompt = "[nix]λ ";
|
||||
extra-substituters = [
|
||||
"https://cache.iog.io"
|
||||
"https://cache.zw3rk.com" # https://github.com/input-output-hk/haskell.nix/issues/1408
|
||||
];
|
||||
extra-trusted-public-keys = [
|
||||
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
|
||||
"loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk="
|
||||
];
|
||||
};
|
||||
|
||||
outputs = { flake-utils, nixpkgs, self }:
|
||||
inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
|
||||
inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, haskellNix }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
config = {};
|
||||
overlays = [ (import ./haskell-overlay.nix) ];
|
||||
pkgs = import nixpkgs { inherit config overlays system; };
|
||||
in rec {
|
||||
defaultPackage = packages.website;
|
||||
overlays = [ haskellNix.overlay
|
||||
(final: prev: {
|
||||
bobProject = final.haskell-nix.project' {
|
||||
src = ./ssg;
|
||||
compiler-nix-name = "ghc925";
|
||||
shell.buildInputs = [
|
||||
hakyll-site
|
||||
];
|
||||
shell.tools = {
|
||||
cabal = "latest";
|
||||
hlint = "latest";
|
||||
haskell-language-server = "latest";
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
packages = with pkgs.myHaskellPackages; { inherit ssg website; };
|
||||
|
||||
apps.default = flake-utils.lib.mkApp {
|
||||
drv = packages.ssg;
|
||||
exePath = "/bin/hakyll-site";
|
||||
pkgs = import nixpkgs {
|
||||
inherit overlays system;
|
||||
inherit (haskellNix) config;
|
||||
};
|
||||
|
||||
devShell = pkgs.myHaskellPackages.shellFor {
|
||||
packages = p: [ p.ssg ];
|
||||
flake = pkgs.bobProject.flake {};
|
||||
|
||||
buildInputs = with pkgs.myHaskellPackages; [
|
||||
ssg
|
||||
executable = "ssg:exe:hakyll-site";
|
||||
|
||||
# Helpful tools for `nix develop` shells
|
||||
#
|
||||
#ghcid # https://github.com/ndmitchell/ghcid
|
||||
#haskell-language-server # https://github.com/haskell/haskell-language-server
|
||||
#hlint # https://github.com/ndmitchell/hlint
|
||||
#ormolu # https://github.com/tweag/ormolu
|
||||
];
|
||||
hakyll-site = flake.packages.${executable};
|
||||
|
||||
withHoogle = true;
|
||||
website = pkgs.stdenv.mkDerivation {
|
||||
name = "website";
|
||||
buildInputs = [];
|
||||
src = pkgs.nix-gitignore.gitignoreSourcePure [
|
||||
./.gitignore
|
||||
".git"
|
||||
".github"
|
||||
] ./.;
|
||||
|
||||
# LANG and LOCALE_ARCHIVE are fixes pulled from the community:
|
||||
# https://github.com/jaspervdj/hakyll/issues/614#issuecomment-411520691
|
||||
# https://github.com/NixOS/nix/issues/318#issuecomment-52986702
|
||||
# https://github.com/MaxDaten/brutal-recipes/blob/source/default.nix#L24
|
||||
LANG = "en_US.UTF-8";
|
||||
LOCALE_ARCHIVE = pkgs.lib.optionalString
|
||||
(pkgs.buildPlatform.libc == "glibc")
|
||||
"${pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||
|
||||
buildPhase = ''
|
||||
${flake.packages.${executable}}/bin/hakyll-site build --verbose
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/dist"
|
||||
cp -r dist/* "$out/dist"
|
||||
'';
|
||||
};
|
||||
|
||||
in flake // rec {
|
||||
apps = {
|
||||
default = flake-utils.lib.mkApp {
|
||||
drv = hakyll-site;
|
||||
exePath = "/bin/hakyll-site";
|
||||
};
|
||||
};
|
||||
|
||||
packages = {
|
||||
inherit hakyll-site website;
|
||||
default = website;
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue