87 lines
2.2 KiB
Nix
87 lines
2.2 KiB
Nix
|
{
|
||
|
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";
|
||
|
};
|
||
|
|
||
|
flake-utils.url = "github:numtide/flake-utils";
|
||
|
|
||
|
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@{
|
||
|
nixpkgs,
|
||
|
typix,
|
||
|
flake-utils,
|
||
|
...
|
||
|
}:
|
||
|
flake-utils.lib.eachDefaultSystem (
|
||
|
system:
|
||
|
let
|
||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||
|
in
|
||
|
let
|
||
|
typstPackagesSrc = "${inputs.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"/*
|
||
|
'';
|
||
|
};
|
||
|
in
|
||
|
let
|
||
|
inherit pkgs;
|
||
|
typixLib = typix.lib.${system};
|
||
|
in
|
||
|
{
|
||
|
# checks = {
|
||
|
# inherit build-drv build-script watch-script;
|
||
|
# };
|
||
|
|
||
|
packages.default = import ./documents/by-course/phil-1/paper-1/package.nix {
|
||
|
inherit pkgs typixLib typstPackagesCache;
|
||
|
};
|
||
|
# apps = rec {
|
||
|
# default = watch;
|
||
|
# build = flake-utils.lib.mkApp {
|
||
|
# drv = build-script;
|
||
|
# };
|
||
|
# watch = flake-utils.lib.mkApp {
|
||
|
# drv = watch-script;
|
||
|
# };
|
||
|
# };
|
||
|
#
|
||
|
# 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
|
||
|
# ];
|
||
|
# };
|
||
|
}
|
||
|
);
|
||
|
}
|