reshuffle things
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,7 +1,10 @@
|
||||
lib.typ
|
||||
# lib.typ
|
||||
lib/
|
||||
src/lib/
|
||||
config/universities.yaml
|
||||
|
||||
*.pdf
|
||||
|
||||
# nix artifacts
|
||||
result
|
||||
result-*
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#import "utils.typ": code
|
||||
|
||||
= Код програми sample.c <foo-c>
|
||||
#code(read("assets/sample.c"))
|
||||
27
flake.lock
generated
27
flake.lock
generated
@@ -21,8 +21,8 @@
|
||||
"local-nure": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1768300920,
|
||||
"narHash": "sha256-Ndy2YhxHFyMCy0B5oT+nRlA3T8S16u1AzPCKlK9UJ4I=",
|
||||
"lastModified": 1769126611,
|
||||
"narHash": "sha256-4qmXN7kx87pEpZHFJpyRbLfZ5GanF5Jbi1Bmfx6ZXss=",
|
||||
"path": "/storage/git/typst_nure_template",
|
||||
"type": "path"
|
||||
},
|
||||
@@ -31,6 +31,22 @@
|
||||
"type": "path"
|
||||
}
|
||||
},
|
||||
"local-nure-upstream": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1768301144,
|
||||
"narHash": "sha256-VHZXALfaAw5f32mClZTS7MeTSaDSQtErAjI+lgpYIZk=",
|
||||
"ref": "refs/heads/0.1.0",
|
||||
"rev": "549d7f060f81a6356c43b2c231e6453ddae19fca",
|
||||
"revCount": 111,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@gitea.linerds.us/pencelheimer/typst_nure_template"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@gitea.linerds.us/pencelheimer/typst_nure_template"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1763421233,
|
||||
@@ -51,6 +67,7 @@
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"local-nure": "local-nure",
|
||||
"local-nure-upstream": "local-nure-upstream",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"typix": "typix"
|
||||
}
|
||||
@@ -77,11 +94,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1762505280,
|
||||
"narHash": "sha256-9/DYuuh14LCQDpWZceY2GF3UvUX2PCrH9eqryBULOqk=",
|
||||
"lastModified": 1769071922,
|
||||
"narHash": "sha256-WD8cMrUlqWJWDAD8+B6MUyEuWvi/fgGgv5Wg0xF/Zkc=",
|
||||
"owner": "loqusion",
|
||||
"repo": "typix",
|
||||
"rev": "489712e2665e1991d17e574b2a69662011cb9113",
|
||||
"rev": "5d334996b24af342b0992f7f432fcb301ed67314",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
133
flake.nix
133
flake.nix
@@ -9,9 +9,11 @@
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
local-nure.url = "git+ssh://gitea@gitea.linerds.us/pencelheimer/typst_nure_template";
|
||||
# local-nure.url = "git+ssh://gitea@gitea.linerds.us/unexplrd/typst_nure_template";
|
||||
# local-nure.url = "path:/storage/git/typst_nure_template";
|
||||
local-nure-upstream.url = "git+ssh://gitea@gitea.linerds.us/pencelheimer/typst_nure_template";
|
||||
local-nure-upstream.flake = false;
|
||||
|
||||
local-nure.url = "path:/storage/git/typst_nure_template";
|
||||
local-nure.flake = false;
|
||||
|
||||
# Example of downloading icons from a non-flake source
|
||||
@@ -30,23 +32,26 @@
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
inherit (pkgs) lib;
|
||||
# inherit (lib.strings) escapeShellArg;
|
||||
inherit (lib.strings) escapeShellArg;
|
||||
|
||||
typixLib = typix.lib.${system};
|
||||
|
||||
src = lib.fileset.toSource {
|
||||
root = ./.;
|
||||
fileset = lib.fileset.unions [
|
||||
(lib.fileset.fromSource (typixLib.cleanTypstSource ./.))
|
||||
(lib.fileset.maybeMissing ./assets)
|
||||
(lib.fileset.maybeMissing ./chapters)
|
||||
(lib.fileset.maybeMissing ./doc.toml)
|
||||
(lib.fileset.maybeMissing ./figures)
|
||||
(lib.fileset.maybeMissing ./utils.typ)
|
||||
# lib/ gets imported, which is unwanted
|
||||
# (lib.fileset.fromSource (typixLib.cleanTypstSource ./.))
|
||||
# ./main.typ
|
||||
# (lib.fileset.maybeMissing ./doc.toml)
|
||||
# (lib.fileset.maybeMissing ./utils.typ)
|
||||
# (lib.fileset.maybeMissing ./chapters)
|
||||
# (lib.fileset.maybeMissing ./assets)
|
||||
# (lib.fileset.maybeMissing ./figures)
|
||||
./src
|
||||
];
|
||||
};
|
||||
commonArgs = {
|
||||
typstSource = "main.typ";
|
||||
typstSource = "src/main.typ";
|
||||
|
||||
fontPaths = [
|
||||
"${pkgs.liberation_ttf}/share/fonts/truetype"
|
||||
@@ -58,42 +63,48 @@
|
||||
|
||||
virtualPaths = [
|
||||
# Add paths that must be locally accessible to typst here
|
||||
{
|
||||
dest = "lib.typ";
|
||||
src = "${inputs.local-nure}/lib.typ";
|
||||
}
|
||||
{
|
||||
dest = "config/universities.yaml";
|
||||
src = "${inputs.local-nure}/config/universities.yaml";
|
||||
}
|
||||
# {
|
||||
# dest = "src/lib";
|
||||
# src = "${inputs.local-nure}/src";
|
||||
# }
|
||||
# {
|
||||
# dest = "config/universities.yaml";
|
||||
# src = "${inputs.local-nure}/src/config/universities.yaml";
|
||||
# }
|
||||
];
|
||||
};
|
||||
|
||||
# mkTypstPackagesDrv = name: entries: let
|
||||
# linkFarmEntries =
|
||||
# lib.foldl (set: {
|
||||
# name,
|
||||
# version,
|
||||
# namespace,
|
||||
# input,
|
||||
# }:
|
||||
# set
|
||||
# // {
|
||||
# "${namespace}/${name}/${version}" = input;
|
||||
# })
|
||||
# {}
|
||||
# entries;
|
||||
# in
|
||||
# pkgs.linkFarm name linkFarmEntries;
|
||||
mkTypstPackagesDrv = name: entries: let
|
||||
linkFarmEntries =
|
||||
lib.foldl (set: {
|
||||
name,
|
||||
version,
|
||||
namespace,
|
||||
input,
|
||||
}:
|
||||
set
|
||||
// {
|
||||
"${namespace}/${name}/${version}" = input;
|
||||
})
|
||||
{}
|
||||
entries;
|
||||
in
|
||||
pkgs.linkFarm name linkFarmEntries;
|
||||
|
||||
# unpublishedTypstPackages = mkTypstPackagesDrv "unpublished-packages" [
|
||||
# {
|
||||
# name = "nure";
|
||||
# version = "0.1.0";
|
||||
# namespace = "local";
|
||||
# input = inputs.local-nure;
|
||||
# }
|
||||
# ];
|
||||
unpublishedTypstPackages = mkTypstPackagesDrv "unpublished-packages" [
|
||||
{
|
||||
name = "test-multifile";
|
||||
version = "0.1.0";
|
||||
namespace = "unexplrd";
|
||||
input = inputs.local-nure;
|
||||
}
|
||||
{
|
||||
name = "nure";
|
||||
version = "0.1.0";
|
||||
namespace = "local";
|
||||
input = inputs.local-nure-upstream;
|
||||
}
|
||||
];
|
||||
|
||||
# Any transitive dependencies must be added here
|
||||
# See https://loqusion.github.io/typix/recipes/using-typst-packages.html#the-typstpackages-attribute
|
||||
@@ -111,7 +122,7 @@
|
||||
// {
|
||||
inherit src;
|
||||
# inherit unstable_typstPackages;
|
||||
# TYPST_PACKAGE_PATH = unpublishedTypstPackages;
|
||||
TYPST_PACKAGE_PATH = unpublishedTypstPackages;
|
||||
});
|
||||
|
||||
# Compile a Typst project, and then copy the result
|
||||
@@ -120,18 +131,19 @@
|
||||
// {
|
||||
inherit src;
|
||||
# inherit unstable_typstPackages;
|
||||
# TYPST_PACKAGE_PATH = unpublishedTypstPackages;
|
||||
TYPST_PACKAGE_PATH = unpublishedTypstPackages;
|
||||
});
|
||||
|
||||
# Watch a project and recompile on changes
|
||||
watch-script = typixLib.watchTypstProject (commonArgs
|
||||
// {
|
||||
# typstWatchCommand = "TYPST_PACKAGE_PATH=${escapeShellArg unpublishedTypstPackages} typst watch";
|
||||
watch-script = typixLib.watchTypstProject (lib.recursiveUpdate commonArgs
|
||||
{
|
||||
typstWatchCommand = "TYPST_PACKAGE_PATH=${escapeShellArg unpublishedTypstPackages} typst watch";
|
||||
});
|
||||
in {
|
||||
checks = {inherit build-drv build-script watch-script;};
|
||||
|
||||
packages.default = build-drv;
|
||||
packages.watch = watch-script;
|
||||
|
||||
apps = rec {
|
||||
default = watch;
|
||||
@@ -145,19 +157,20 @@
|
||||
|
||||
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
|
||||
]
|
||||
++ (with pkgs; [
|
||||
# More packages can be added here, like typstfmt
|
||||
just
|
||||
typstfmt
|
||||
yq
|
||||
]);
|
||||
|
||||
env = {
|
||||
TYPST_PACKAGE_PATH = escapeShellArg unpublishedTypstPackages;
|
||||
};
|
||||
packages = with pkgs; [
|
||||
# WARNING: Don't run `typst-build` directly, instead use `nix run .#build`
|
||||
# See https://github.com/loqusion/typix/issues/2
|
||||
# build-script
|
||||
watch-script
|
||||
|
||||
just
|
||||
typstyle
|
||||
yq
|
||||
];
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
8
justfile
8
justfile
@@ -3,9 +3,9 @@ alias c := compile
|
||||
|
||||
alias nw := nix-watch
|
||||
alias nb := nix-build
|
||||
alias ns := nix-shell
|
||||
alias nd := nix-develop
|
||||
|
||||
file := "main.typ"
|
||||
file := "src/main.typ"
|
||||
out := `cat doc.toml | tomlq '.doctype + (.worknumber | tostring) + "_" + (.authors[0].name | split(" ")[0]) + "_" + (.authors[0].edu + "-" + .authors[0].group) + "_" + .subject + ".pdf"'`
|
||||
|
||||
[group('typst')]
|
||||
@@ -19,8 +19,8 @@ copy-done:
|
||||
cp main.pdf ../{{out}}
|
||||
|
||||
[group('nix')]
|
||||
nix-shell:
|
||||
nix shell nixpkgs#{yq,typst}
|
||||
nix-develop:
|
||||
nix develop .
|
||||
[group('nix')]
|
||||
nix-watch:
|
||||
nix run .#watch
|
||||
|
||||
4
src/chapters/appendices.typ
Normal file
4
src/chapters/appendices.typ
Normal file
@@ -0,0 +1,4 @@
|
||||
#import "/utils.typ": code
|
||||
|
||||
= Код програми sample.c <foo-c>
|
||||
#code(read("/assets/sample.c"))
|
||||
@@ -16,7 +16,7 @@ gender = "m"
|
||||
|
||||
[[authors]]
|
||||
name = "Косач Л. П."
|
||||
edu_program = "ПЗПІ"
|
||||
edu_program = "КУІБ"
|
||||
group = "23-2"
|
||||
gender = "f"
|
||||
variant = 8
|
||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@@ -1,11 +1,14 @@
|
||||
#import "/lib.typ": *
|
||||
#import "/utils.typ": *
|
||||
#import "@unexplrd/test-multifile:0.1.0": *
|
||||
// #import "/lib/lib.typ": *
|
||||
#import "utils.typ": *
|
||||
|
||||
#import style: spacing
|
||||
|
||||
// #show: correctly-indent-list-and-enum-items
|
||||
|
||||
// #show: dstu-style // Для рефератів, нестандартних робіт, тощо
|
||||
// #show: style.dstu
|
||||
#show: pz-lb.with(
|
||||
..toml("/doc.toml"),
|
||||
..toml("doc.toml"),
|
||||
title: lorem(2),
|
||||
)
|
||||
|
||||
@@ -28,7 +31,7 @@ $ 1/2 dot 3 = 3/2 $
|
||||
|
||||
#lorem(20)
|
||||
|
||||
#img("figures/Google-Logo-700x394.png", [Корпорація зла], width: 60%)
|
||||
// #img("/figures/Google-Logo-700x394.png", [Корпорація зла], width: 60%)
|
||||
|
||||
|
||||
#lorem(50)
|
||||
@@ -48,4 +51,4 @@ $ 1/2 dot 3 = 3/2 $
|
||||
|
||||
#lorem(20)
|
||||
|
||||
#appendices-style(include "appendices.typ")
|
||||
#style.appendices(include "chapters/appendices.typ")
|
||||
@@ -1,6 +1,9 @@
|
||||
/// takes in a string of code, e.g. #code(read("foo.c"))
|
||||
#let code(content) = raw(block: true, theme: none, content)
|
||||
|
||||
/// read file as bytes
|
||||
#let p(path) = bytes(read(path, encoding: none))
|
||||
|
||||
/// include chapters by file names from /chapters
|
||||
#let chapters(ch) = (
|
||||
array(ch).map(chapter => include str(chapter) + ".typ").join()
|
||||
Reference in New Issue
Block a user