resume/flake.nix

80 lines
1.8 KiB
Nix
Raw Normal View History

2023-04-14 21:26:00 +00:00
{
inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
systems = {
url = "github:nix-systems/default";
};
font-awesome = {
url = "github:duskmoon314/typst-fontawesome";
flake = false;
};
2023-04-14 21:26:00 +00:00
};
outputs = {
self,
nixpkgs,
flake-parts,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = import inputs.systems;
perSystem = {
pkgs,
system,
...
}: let
fonts_path = with pkgs; lib.concatStringsSep ":" [lato font-awesome raleway];
2023-04-14 21:26:00 +00:00
in {
devShells.default = pkgs.mkShell {
2023-11-24 21:58:56 +00:00
packages = with pkgs; [
typst
2023-11-24 21:58:56 +00:00
typstfmt
typst-lsp
typst-live
typst-preview
];
TYPST_FONT_PATHS = fonts_path;
};
packages.default = pkgs.stdenvNoCC.mkDerivation {
name = "resume";
dontUnpack = true;
buildInputs = with pkgs; [typst];
2023-11-24 21:58:56 +00:00
TYPST_FONT_PATHS = fonts_path;
src = ./.;
fontawesome = inputs.font-awesome;
2023-11-24 21:58:56 +00:00
buildPhase = ''
# copy sources
cp -r $src/src .
chmod -R +w src
# replace fontawesome remote import with local import
cp $fontawesome/lib.typ src/fontawesome.typ
sed -i 's/#import "@preview\/fontawesome:0\.1\.0": \*/#import "fontawesome.typ": */g' src/resume.typ
# compile typst to pdf
typst compile src/resume.typ resume.pdf
'';
installPhase = ''
mkdir -p $out
cp resume.pdf $out/resume.pdf
'';
2023-04-14 21:26:00 +00:00
};
};
};
2023-04-14 21:26:00 +00:00
}