Add an overlay to the Nix flake (#377)

This commit is contained in:
figsoda 2023-03-27 16:42:05 -04:00 committed by GitHub
parent 1e9d6b4aaa
commit 9dd8ad7b19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,27 @@
substring 0 8 self.rev
else
fallback;
packageFor = pkgs: pkgs.rustPlatform.buildRustPackage {
pname = "typst";
version = rev "00000000";
src = self;
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
buildInputs = optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.CoreServices
];
cargoBuildFlags = [ "-p" "typst-cli" ];
cargoTestFlags = [ "-p" "typst-cli" ];
TYPST_VERSION = rev "(unknown version)";
};
in
{
devShells = eachSystem (pkgs: {
@ -50,27 +71,12 @@
formatter = eachSystem (pkgs: pkgs.nixpkgs-fmt);
overlays.default = _: prev: {
typst-dev = packageFor prev;
};
packages = eachSystem (pkgs: {
default = pkgs.rustPlatform.buildRustPackage {
pname = "typst";
version = rev "00000000";
src = self;
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
buildInputs = optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.CoreServices
];
cargoBuildFlags = [ "-p" "typst-cli" ];
cargoTestFlags = [ "-p" "typst-cli" ];
TYPST_VERSION = rev "(unknown version)";
};
default = packageFor pkgs;
});
};
}