Skip to content

Commit

Permalink
Merge pull request #301087 from pbsds/bump-pagefind-1712096613
Browse files Browse the repository at this point in the history
pagefind: 1.0.4 -> 1.1.0
  • Loading branch information
pbsds authored Apr 3, 2024
2 parents 49162d3 + 466e57c commit e4b3cf2
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions pkgs/applications/misc/pagefind/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@

let

wasm-bindgen-84 = wasm-bindgen-cli.override {
version = "0.2.84";
hash = "sha256-0rK+Yx4/Jy44Fw5VwJ3tG243ZsyOIBBehYU54XP/JGk=";
cargoHash = "sha256-vcpxcRlW1OKoD64owFF6mkxSqmNrvY+y3Ckn5UwEQ50=";
wasm-bindgen-92 = wasm-bindgen-cli.override {
version = "0.2.92";
hash = "sha256-1VwY8vQy7soKEgbki4LD+v259751kKxSxmo/gqE6yV0=";
cargoHash = "sha256-aACJ+lYNEU8FFBs158G1/JG8sc6Rq080PeKCMnwdpH0=";
};

in

rustPlatform.buildRustPackage rec {
pname = "pagefind";
version = "1.0.4";
version = "1.1.0";

src = fetchFromGitHub {
owner = "cloudcannon";
repo = "pagefind";
rev = "refs/tags/v${version}";
hash = "sha256-IN+l5Wq89tjppE0xCcvczQSkJc1CLymEFeieJhvQQ54=";
hash = "sha256-pcgcu9zylSTjj5rxNff+afFBWVpN5sGtlpadG1wb93M=";
};

cargoHash = "sha256-T7DBuqfpqaEmu9iItnFYsJVnEFxG1r9uXEkfqJp1mD8=";
cargoHash = "sha256-E4gjG5GrVWkMKgjQiAvEiSy2/tx/yHKe+5isveMZ9tU=";

env.npmDeps_web_js = fetchNpmDeps {
name = "npm-deps-web-js";
Expand All @@ -50,6 +50,11 @@ rustPlatform.buildRustPackage rec {
src = "${src}/pagefind_ui/modular";
hash = "sha256-O0RqZUsRFtByxMQdwNGNcN38Rh+sDqqNo9YlBcrnsF4=";
};
env.cargoDeps_web = rustPlatform.fetchCargoTarball {
name = "cargo-deps-web";
src = "${src}/pagefind_web/";
hash = "sha256-vDkVXyDePKgYTYE5ZTLLfOHwPYfgaqP9p5/fKCQQi0g=";
};

postPatch = ''
# Tricky way to run npmConfigHook multiple times
Expand All @@ -60,6 +65,11 @@ rustPlatform.buildRustPackage rec {
npmRoot=pagefind_ui/default npmDeps=$npmDeps_ui_default npmConfigHook
npmRoot=pagefind_ui/modular npmDeps=$npmDeps_ui_modular npmConfigHook
)
(
cd pagefind_web
cargoDeps=$cargoDeps_web cargoSetupPostUnpackHook
cargoDeps=$cargoDeps_web cargoSetupPostPatchHook
)
'';

nativeBuildInputs = [
Expand All @@ -68,30 +78,35 @@ rustPlatform.buildRustPackage rec {
nodejs
rustc
rustc.llvmPackages.lld
wasm-bindgen-84
wasm-bindgen-92
wasm-pack
];

# build wasm and js assets
# based on "test-and-build" in https://github.com/CloudCannon/pagefind/blob/main/.github/workflows/release.yml
preBuild = ''
export HOME=$(mktemp -d)
echo entering pagefind_web_js...
(
cd pagefind_web_js
npm run build-coupled
)
echo entering pagefind_web...
(
cd pagefind_web
export RUSTFLAGS="-C linker=lld"
bash ./local_build.sh
)
echo entering pagefind_ui/default...
(
cd pagefind_ui/default
npm run build
)
echo entering pagefind_ui/modular...
(
cd pagefind_ui/modular
npm run build
Expand Down

0 comments on commit e4b3cf2

Please sign in to comment.