automuse/flake.nix
Xe Iaso 88951b1646 paper
Signed-off-by: Xe Iaso <me@xeiaso.net>
2023-04-15 16:21:39 -04:00

56 lines
1.6 KiB
Nix

{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
# Explicitly pulling from that version of nixpkgs to avoid font duplication.
iosevka.url = "github:Xe/iosevka";
typst.url = "github:typst/typst";
typst.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, utils, typst, iosevka }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ typst.overlays.default ];
};
typstWithIosevka = let
fontsConf = pkgs.symlinkJoin {
name = "typst-fonts";
paths =
[ "${self.packages.${system}.iosevka}" ];
};
in pkgs.writeShellApplication {
name = "typst";
text = ''
${pkgs.typst-dev}/bin/typst \
--font-path ${fontsConf} \
"$@"
'';
runtimeInputs = [ ];
};
in {
packages.iosevka = pkgs.stdenvNoCC.mkDerivation {
name = "iosevka-iaso-ttf";
buildInputs = with pkgs; [ unzip ];
dontUnpack = true;
buildPhase = ''
unzip ${self.inputs.iosevka.packages.${system}.default}/ttf.zip
'';
installPhase = ''
mkdir -p $out
cp ttf/* $out
'';
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ nodejs-18_x pandoc typstWithIosevka calibre ];
shellHook = ''
export PATH="$PATH":$(pwd)/node_modules/.bin
'';
};
});
}