{ description = "Personal site"; inputs = { flake-parts.url = "github:hercules-ci/flake-parts"; treefmt-nix.url = "github:numtide/treefmt-nix"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; outputs = inputs@{ self, flake-parts, treefmt-nix, ... }: flake-parts.lib.mkFlake { inherit inputs; } { imports = [ treefmt-nix.flakeModule ]; systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; perSystem = { pkgs, ... }: { devShells.default = pkgs.mkShell { buildInputs = with pkgs; [ zola python3Packages.fonttools python3Packages.brotli ]; }; packages.default = pkgs.stdenv.mkDerivation { name = "site"; src = ./.; nativeBuildInputs = with pkgs; [ zola python3Packages.fonttools python3Packages.brotli ]; postPatch = '' substituteInPlace config.toml \ --replace-fail "__GIT_COMMIT__" "${self.shortRev or "dirty"}" \ --replace-fail "__GIT_COMMIT_FULL__" "${self.rev or "dirty"}" ''; buildPhase = '' zola build --output-dir public ''; installPhase = '' mkdir -p $out cp -r public/* $out/ ''; }; treefmt = { programs = { djlint = { enable = true; indent = 2; }; nixfmt.enable = true; }; settings.formatter.djlint = { options = [ "--profile" "jinja" ]; includes = [ "*.html" ]; }; }; }; flake = { # The usual flake attributes can be defined here, including system- # agnostic ones like nixosModule and system-enumerating ones, although # those are more easily expressed in perSystem. }; }; }