ft: add initial presentation template
This commit is contained in:
96
flake.nix
Normal file
96
flake.nix
Normal file
@@ -0,0 +1,96 @@
|
||||
{
|
||||
description = "A Typst project";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
typix = {
|
||||
url = "github:loqusion/typix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
# 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};
|
||||
inherit (pkgs) lib;
|
||||
|
||||
typixLib = typix.lib.${system};
|
||||
|
||||
src = typixLib.cleanTypstSource ./.;
|
||||
commonArgs = {
|
||||
typstSource = "main.typ";
|
||||
|
||||
fontPaths = [
|
||||
# Add paths to fonts here
|
||||
# "${pkgs.roboto}/share/fonts/truetype"
|
||||
];
|
||||
|
||||
virtualPaths = [
|
||||
# Add paths that must be locally accessible to typst here
|
||||
# {
|
||||
# dest = "icons";
|
||||
# src = "${inputs.font-awesome}/svgs/regular";
|
||||
# }
|
||||
];
|
||||
};
|
||||
|
||||
# Compile a Typst project, *without* copying the result
|
||||
# to the current directory
|
||||
build-drv = typixLib.buildTypstProject (commonArgs
|
||||
// {
|
||||
inherit src;
|
||||
});
|
||||
|
||||
# Compile a Typst project, and then copy the result
|
||||
# to the current directory
|
||||
build-script = typixLib.buildTypstProjectLocal (commonArgs
|
||||
// {
|
||||
inherit src;
|
||||
});
|
||||
|
||||
# Watch a project and recompile on changes
|
||||
watch-script = typixLib.watchTypstProject commonArgs;
|
||||
in {
|
||||
checks = {
|
||||
inherit build-drv build-script watch-script;
|
||||
};
|
||||
|
||||
packages.default = build-drv;
|
||||
|
||||
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.typstfmt
|
||||
];
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user