56 lines
1.5 KiB
Nix
56 lines
1.5 KiB
Nix
{
|
|
nixConfig = {
|
|
trusted-substituters = "https://cache.nixos.org/";
|
|
trusted-public-keys = "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=";
|
|
extra-experimental-features = "nix-command flakes";
|
|
};
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
outputs = {
|
|
self,
|
|
nixpkgs,
|
|
flake-utils,
|
|
...
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
|
pkgs = import nixpkgs {inherit system;};
|
|
devDeps = with pkgs; [hugo brotli zopfli parallel];
|
|
in {
|
|
devShells.default = pkgs.mkShell {
|
|
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
|
packages = devDeps;
|
|
};
|
|
|
|
# TODO: cache
|
|
defaultPackage = pkgs.stdenv.mkDerivation {
|
|
pname = "jakstys.lt";
|
|
version = "1.0.0";
|
|
|
|
src = pkgs.lib.cleanSource self;
|
|
|
|
buildInputs = [pkgs.hugo];
|
|
|
|
buildPhase = ''
|
|
${pkgs.hugo}/bin/hugo --cleanDestinationDir --printPathWarnings --panicOnWarning --log
|
|
find public \
|
|
-name '*.html' -or \
|
|
-name '*.xml' -or \
|
|
-name '*.txt' -or \
|
|
-name '*.css' -or \
|
|
-name '*.map' -or \
|
|
-name '*.pdf' | \
|
|
${pkgs.parallel}/bin/parallel --eta \
|
|
"${pkgs.zopfli}/bin/zopfli {} && ${pkgs.brotli}/bin/brotli {}"
|
|
'';
|
|
|
|
installPhase = ''
|
|
mv public $out
|
|
'';
|
|
};
|
|
|
|
formatter = pkgs.alejandra;
|
|
});
|
|
}
|