blogng/flake.nix

56 lines
1.5 KiB
Nix
Raw Normal View History

2023-11-15 08:47:53 +00:00
{
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}.website;
defaultPackage = self.packages.${system}.default;
packages.website = 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; [
2024-01-07 15:18:17 +00:00
builder
2023-11-15 08:47:53 +00:00
haskellPackages.haskell-language-server # you must build it with your ghc to work
ghcid
cabal-install
2024-01-07 15:18:17 +00:00
nodePackages.prettier
2023-11-15 08:47:53 +00:00
];
};
devShell = self.devShells.${system}.default;
});
}