From 1ff976cd360752c6c3cc3b26785f638f81cc4507 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Mon, 6 Jan 2025 15:44:51 -0800 Subject: [PATCH] feat: add flakeSelf and package.nix for course notes --- .../pstat-120a/course-notes/package.nix | 37 +++++++++++++++++++ documents/flake.nix | 1 + 2 files changed, 38 insertions(+) create mode 100644 documents/by-course/pstat-120a/course-notes/package.nix diff --git a/documents/by-course/pstat-120a/course-notes/package.nix b/documents/by-course/pstat-120a/course-notes/package.nix new file mode 100644 index 0000000..7879e7e --- /dev/null +++ b/documents/by-course/pstat-120a/course-notes/package.nix @@ -0,0 +1,37 @@ +{ + pkgs, + typstPackagesCache, + typixLib, + cleanTypstSource, + flakeSelf, + ... +}: +let + src = 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"; + # } + ]; + + XDG_CACHE_HOME = typstPackagesCache; + SOURCE_DATE_EPOCH = builtins.toString flakeSelf.lastModified; + }; + +in +typixLib.buildTypstProject ( + commonArgs + // { + inherit src; + } +) diff --git a/documents/flake.nix b/documents/flake.nix index a5da4ae..e3af851 100644 --- a/documents/flake.nix +++ b/documents/flake.nix @@ -66,6 +66,7 @@ let alexandriaLib = import ./nix/lib { inherit pkgs typixLib typstPackagesCache; + flakeSelf = self; }; in