generated from marius/TUM_Slides
Initial commit
This commit is contained in:
commit
a3d8f1fdd9
14 changed files with 453 additions and 0 deletions
155
flake.nix
Normal file
155
flake.nix
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
{
|
||||
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"
|
||||
"./template/resources"
|
||||
];
|
||||
|
||||
virtualPaths = [
|
||||
# Add paths that must be locally accessible to typst here
|
||||
# {
|
||||
# dest = "icons";
|
||||
# src = "${inputs.font-awesome}/svgs/regular";
|
||||
# }
|
||||
# {
|
||||
# dest = "./graphics/";
|
||||
# src = ./graphics;
|
||||
# }
|
||||
#{
|
||||
# dest = "./bibliography.bib";
|
||||
# src = ./bibliography.bib;
|
||||
#}
|
||||
{
|
||||
dest = "./template/";
|
||||
src = ./template;
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
};
|
||||
|
||||
unstable_typstPackages = [
|
||||
{
|
||||
name = "touying";
|
||||
version = "0.6.1";
|
||||
hash = "sha256-bTDc32MU4GPbUbW5p4cRSxsl9ODR6qXinvQGeHu2psU=";
|
||||
}
|
||||
{
|
||||
name = "cetz-plot";
|
||||
version = "0.1.1";
|
||||
hash= "sha256-w5n7gCT6gDtxMvYjDhrwrPjT0b2M69whEUDByjTYDtQ=";
|
||||
}
|
||||
|
||||
{
|
||||
name = "cetz";
|
||||
version = "0.3.4";
|
||||
hash = "sha256-5w3UYRUSdi4hCvAjrp9HslzrUw7BhgDdeCiDRHGvqd4=";
|
||||
}
|
||||
{
|
||||
name = "cetz";
|
||||
version = "0.3.2";
|
||||
hash = "sha256-3Abz+31Y61rZUnnKlXayqIsEYEOaD47BQPUMwm0i0xA=";
|
||||
}
|
||||
{
|
||||
name = "oxifmt";
|
||||
version = "0.2.1";
|
||||
hash = "sha256-8PNPa9TGFybMZ1uuJwb5ET0WGIInmIgg8h24BmdfxlU=";
|
||||
}
|
||||
{
|
||||
name = "codly";
|
||||
version = "1.3.0";
|
||||
hash = "sha256-WcqvySmSYpWW+TmZT7TgPFtbEHA+bP5ggKPll0B8fHk=";
|
||||
}
|
||||
{
|
||||
name = "codly-languages";
|
||||
version = "0.1.1";
|
||||
hash= "sha256-TSp3unFhn3NSaWhWYZb/i3rD4OolbNZNTdQeBxJ4Jfs=";
|
||||
}
|
||||
{
|
||||
name = "fletcher";
|
||||
version = "0.5.8";
|
||||
hash = "sha256-kKVp5WN/EbHEz2GCTkr8i8DRiAdqlr4R7EW6drElgWk=";
|
||||
}
|
||||
];
|
||||
|
||||
# Compile a Typst project, *without* copying the result
|
||||
# to the current directory
|
||||
build-drv = typixLib.buildTypstProject (commonArgs
|
||||
// {
|
||||
inherit src unstable_typstPackages;
|
||||
});
|
||||
|
||||
# Compile a Typst project, and then copy the result
|
||||
# to the current directory
|
||||
build-script = typixLib.buildTypstProjectLocal (commonArgs
|
||||
// {
|
||||
inherit src unstable_typstPackages;
|
||||
});
|
||||
|
||||
# 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
|
||||
];
|
||||
};
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue