2024-10-19 15:13:16 -07:00
|
|
|
{
|
|
|
|
description = "Compiling work in 2024 in a reproducible manner";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
|
|
|
|
typix = {
|
|
|
|
url = "github:loqusion/typix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
|
2024-10-20 17:09:11 -07:00
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
2024-10-19 15:13:16 -07:00
|
|
|
|
|
|
|
typst-packages = {
|
|
|
|
url = "github:typst/packages";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Example of downloading icons from a non-flake source
|
|
|
|
# font-awesome = {
|
|
|
|
# url = "github:FortAwesome/Font-Awesome";
|
|
|
|
# flake = false;
|
|
|
|
# };
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs =
|
|
|
|
inputs@{
|
2024-10-20 17:09:11 -07:00
|
|
|
flake-parts,
|
2024-10-20 11:49:02 -07:00
|
|
|
self,
|
2024-10-20 17:09:11 -07:00
|
|
|
typix,
|
|
|
|
typst-packages,
|
2024-10-19 15:13:16 -07:00
|
|
|
...
|
|
|
|
}:
|
2024-10-20 17:09:11 -07:00
|
|
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
|
|
|
systems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
|
|
|
"x86_64-darwin"
|
|
|
|
"aarch64-darwin"
|
|
|
|
];
|
|
|
|
flake = {
|
|
|
|
hydraJobs = {
|
|
|
|
legacyPackages."x86_64-linux" = self.legacyPackages."x86_64-linux";
|
2024-10-19 15:13:16 -07:00
|
|
|
};
|
2024-10-20 16:56:12 -07:00
|
|
|
};
|
2024-10-20 17:09:11 -07:00
|
|
|
perSystem =
|
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
system,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
typstPackagesSrc = "${typst-packages}/packages";
|
|
|
|
|
|
|
|
typstPackagesCache = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "typst-packages-cache";
|
|
|
|
src = typstPackagesSrc;
|
|
|
|
dontBuild = true;
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/typst/packages"
|
|
|
|
cp -LR --reflink=auto --no-preserve=mode -t "$out/typst/packages" "$src"/*
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
typixLib = typix.lib.${system};
|
|
|
|
in
|
|
|
|
let
|
|
|
|
alexandriaLib = import ./nix/lib {
|
|
|
|
inherit pkgs typixLib typstPackagesCache;
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
{
|
|
|
|
legacyPackages = (
|
|
|
|
(alexandriaLib.indexByName ./documents/by-name)
|
|
|
|
// (alexandriaLib.indexByCourse ./documents/by-course)
|
|
|
|
);
|
|
|
|
# devShells.default = typixLib.devShell {
|
|
|
|
# inherit (commonArgs) fontPaths virtualPaths;
|
|
|
|
# packages = [
|
|
|
|
# # WARNING: Don't run `typst-build` directly, instead use `nix run .#build`
|
|
|
|
# # See https://github.com/loqusion/typix/issues/2
|
|
|
|
# # build-script
|
|
|
|
# watch-script
|
|
|
|
# # More packages can be added here, like typstfmt
|
|
|
|
# pkgs.typstyle
|
|
|
|
# ];
|
|
|
|
# };
|
|
|
|
formatter = pkgs.nixfmt-rfc-style;
|
|
|
|
};
|
|
|
|
# // {
|
2024-10-20 16:56:12 -07:00
|
|
|
};
|
2024-10-19 15:13:16 -07:00
|
|
|
}
|