Files
strom-roku-2023.krk-litvino…/flake.nix
2023-05-18 15:33:26 +02:00

105 lines
2.9 KiB
Nix

{
description = "Source for strom-roku-2023.krk-litvinov.cz";
inputs = {
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
haskellNix.url = "github:input-output-hk/haskell.nix";
nixpkgs.follows = "haskellNix/nixpkgs-unstable";
hakyll-contrib-tojnar = {
url = "gitlab:tojnar.cz/hakyll-contrib-tojnar?ref=master";
flake = false;
};
flake-utils.url = "github:numtide/flake-utils";
};
nixConfig = {
extra-substituters = ["https://cache.iog.io"];
extra-trusted-public-keys = ["hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="];
allow-import-from-derivation = "true";
};
outputs = { self, flake-compat, haskellNix, hakyll-contrib-tojnar, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
compiler = "ghc925";
overlays = [
haskellNix.overlay
(final: prev: {
strom-roku2023-krk-litvinov-cz =
final.haskell-nix.project' {
src = ./site;
compiler-nix-name = compiler;
shell.tools = {
cabal = {};
};
inputMap = {
"https://gitlab.com/tojnar.cz/hakyll-contrib-tojnar/master" = hakyll-contrib-tojnar;
};
};
})
];
pkgs = import nixpkgs {
inherit system;
inherit overlays;
inherit (haskellNix) config;
};
flake = pkgs.strom-roku2023-krk-litvinov-cz.flake {
crossPlatforms = p: [
p.mingwW64
];
};
in flake // {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = [
self.packages.${system}.default
pkgs.vips
];
};
haskell = flake.devShells.default;
};
packages = {
default = flake.packages."strom-roku2023-krk-litvinov-cz:exe:site";
win = flake.packages."x86_64-w64-mingw32:strom-roku2023-krk-litvinov-cz:exe:site";
roots = pkgs.haskell-nix.roots compiler;
winCombined =
let
version = "8.14.1";
vips = pkgs.fetchzip {
url = "https://github.com/libvips/build-win64-mxe/releases/download/v${version}/vips-dev-w64-all-${version}.zip";
hash = "sha256-yGAoRwyfeMTiDSSOfWJp32N85Z8Jdyw8wrvEvmx7BWM=";
};
in
pkgs.runCommand
"generator"
{
nativeBuildInputs = [
pkgs.zip
];
}
''
mkdir -p "$out"
mkdir generator
cp -r "${vips}/bin" "vips"
cp -r "${self.packages.${system}.win}/bin" "site"
zip -9 -r -q "$out/site-bundle.zip" vips/ site/
'';
};
legacyPackages = pkgs;
}
);
}