blogng/flake.nix
Dhananjay Balan cc8c5c8ee1 strip images
2024-03-26 05:58:46 +01:00

59 lines
1.6 KiB
Nix

{
description = "blogng";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
haskellPackages = pkgs.haskellPackages;
builder = pkgs.haskellPackages.callCabal2nix "blogng" ./. { };
in {
packages.default = self.packages.${system}.blog;
defaultPackage = self.packages.${system}.default;
packages.blog = pkgs.stdenv.mkDerivation rec {
name = "blog";
LANG = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
src = ./.;
# use the haskell package to build the website
buildInputs = [ builder ];
allowSubstitutes = false;
buildPhase = ''
mkdir public
${builder}/bin/site build
'';
installPhase = ''
mkdir -p $out/
cp -R public/* $out/
'';
dontStrip = true;
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
builder
haskellPackages.haskell-language-server # you must build it with your ghc to work
ghcid
cabal-install
nodePackages.prettier
python3
# mogrify -strip to strip images
imagemagick
];
};
devShell = self.devShells.${system}.default;
});
}