Initial commit
This commit is contained in:
commit
573abbe7c3
4 changed files with 183 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
result*
|
||||||
|
.direnv
|
||||||
|
.envrc
|
||||||
82
flake.lock
generated
Normal file
82
flake.lock
generated
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731533236,
|
||||||
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1747327360,
|
||||||
|
"narHash": "sha256-LSmTbiq/nqZR9B2t4MRnWG7cb0KVNU70dB7RT4+wYK4=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "e06158e58f3adee28b139e9c2bcfcc41f8625b46",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"typix": "typix"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1746607658,
|
||||||
|
"narHash": "sha256-WKB6j7RddVr2NT1Wze03uw/yiFeEX/F5vdOWSKoj9Z0=",
|
||||||
|
"owner": "loqusion",
|
||||||
|
"repo": "typix",
|
||||||
|
"rev": "01160b19f90eeba0124dea8326779477b5313ebb",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "loqusion",
|
||||||
|
"repo": "typix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
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
|
||||||
|
];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
2
main.typ
Normal file
2
main.typ
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
= Lorem ipsum
|
||||||
|
#lorem(30)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue