resume/flake.nix

66 lines
1.8 KiB
Nix
Raw Normal View History

2023-04-14 21:26:00 +00:00
{
inputs = {
2023-11-24 21:58:56 +00:00
typst.url = "github:typst/typst";
2023-04-14 21:26:00 +00:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
2023-11-24 21:58:56 +00:00
outputs = { self, nixpkgs, typst, flake-utils }:
2023-04-14 21:26:00 +00:00
flake-utils.lib.eachDefaultSystem (system:
2023-11-24 21:58:56 +00:00
let
pkgs = import nixpkgs {
inherit system;
overlays = [ typst.overlays.default ];
};
fonts_path = with pkgs;
lib.concatStringsSep ":" [ lato font-awesome raleway ];
2023-04-14 21:26:00 +00:00
in {
devShell = pkgs.mkShell {
2023-11-24 21:58:56 +00:00
packages = with pkgs; [
typst-dev
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-dev ];
TYPST_FONT_PATHS = fonts_path;
src = ./.;
fontawesome = pkgs.fetchFromGitHub {
owner = "duskmoon314";
repo = "typst-fontawesome";
rev = "1a0fcdca90ee07f297294c9c56fbcf3114340a47";
hash = "sha256-h9LZum2f9+rZ4l4hjcmE49gDLVlbJUkRi1xSbJLVAGg=";
};
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
};
});
}