mirror of
https://github.com/typst/typst
synced 2025-05-15 01:25:28 +08:00
Reduce rebuilds for the Nix flake (#1586)
This makes it so the package doesn't need to be rebuilt when unrelated changes happen, e.g. in README
This commit is contained in:
parent
c44bad5739
commit
084c8642db
14
flake.nix
14
flake.nix
@ -13,7 +13,7 @@
|
|||||||
genAttrs
|
genAttrs
|
||||||
importTOML
|
importTOML
|
||||||
optionals
|
optionals
|
||||||
cleanSource
|
sourceByRegex
|
||||||
;
|
;
|
||||||
|
|
||||||
eachSystem = f: genAttrs
|
eachSystem = f: genAttrs
|
||||||
@ -25,9 +25,6 @@
|
|||||||
]
|
]
|
||||||
(system: f nixpkgs.legacyPackages.${system});
|
(system: f nixpkgs.legacyPackages.${system});
|
||||||
|
|
||||||
rev = fallback:
|
|
||||||
self.shortRev or fallback;
|
|
||||||
|
|
||||||
packageFor = pkgs:
|
packageFor = pkgs:
|
||||||
let
|
let
|
||||||
rust = fenix.packages.${pkgs.stdenv.hostPlatform.system}.minimal.toolchain;
|
rust = fenix.packages.${pkgs.stdenv.hostPlatform.system}.minimal.toolchain;
|
||||||
@ -36,11 +33,15 @@
|
|||||||
rustc = rust;
|
rustc = rust;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
rustPlatform.buildRustPackage rec {
|
rustPlatform.buildRustPackage {
|
||||||
pname = "typst";
|
pname = "typst";
|
||||||
inherit ((importTOML ./Cargo.toml).workspace.package) version;
|
inherit ((importTOML ./Cargo.toml).workspace.package) version;
|
||||||
|
|
||||||
src = cleanSource ./.;
|
src = sourceByRegex ./. [
|
||||||
|
"(assets|cli|docs|library|macros|src|tests)(/.*)?"
|
||||||
|
''Cargo\.(toml|lock)''
|
||||||
|
''build\.rs''
|
||||||
|
];
|
||||||
|
|
||||||
cargoLock = {
|
cargoLock = {
|
||||||
lockFile = ./Cargo.lock;
|
lockFile = ./Cargo.lock;
|
||||||
@ -63,7 +64,6 @@
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
GEN_ARTIFACTS = "artifacts";
|
GEN_ARTIFACTS = "artifacts";
|
||||||
TYPST_VERSION = "${version} (${rev "unknown hash"})";
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user