diff --git a/default.nix b/default.nix index 7dabd4f..86f7715 100644 --- a/default.nix +++ b/default.nix @@ -4,4 +4,5 @@ let in { pinepods = pkgs.callPackage ./pinepods.nix { }; + pinepods-frontend = (pkgs.callPackage ./pinepods.nix { }).frontend; } \ No newline at end of file diff --git a/pinepods.nix b/pinepods.nix index 6a8d6ea..8e7310b 100644 --- a/pinepods.nix +++ b/pinepods.nix @@ -3,6 +3,7 @@ , rustPlatform , pkg-config , wrapGAppsHook3 +, llvmPackages , webkitgtk_4_1 , gtk3 , glib @@ -42,24 +43,29 @@ let sourceRoot = "source/web"; cargoRoot = "."; - postUnpack = '' - cp ${builtins.toString ./.}/Cargo.frontend.lock $sourceRoot/Cargo.lock - ''; - cargoLock = { - lockFile = "${builtins.toString ./.}/Cargo.frontend.lock"; + lockFile = ./Cargo.frontend.lock; outputHashes = { "i18nrs-0.1.7" = "sha256-LEHQ8GI3eVKwhtxetxyIY4HV16TS3D9n+2Hh+sm5j74="; }; }; - nativeBuildInputs = [ trunk wasm-bindgen-cli ]; + nativeBuildInputs = [ trunk wasm-bindgen-cli llvmPackages.lld ]; buildPhase = '' cp -r . $NIX_BUILD_TOP/web-build chmod -R u+w $NIX_BUILD_TOP/web-build cd $NIX_BUILD_TOP/web-build mkdir -p dist + + export HOME=$NIX_BUILD_TOP + export XDG_CACHE_HOME=$NIX_BUILD_TOP/cache + mkdir -p $NIX_BUILD_TOP/cache + + # Use nixpkgs wasm-bindgen, skip trunk's version check + export WASM_BINDGEN=$(which wasm-bindgen) + export TRUNK_SKIP_VERSION_CHECK=true + RUSTFLAGS="--cfg=web_sys_unstable_apis" trunk build --release ''; @@ -78,12 +84,8 @@ rustPlatform.buildRustPackage { sourceRoot = "source/web/src-tauri"; cargoRoot = "."; - postUnpack = '' - cp ${builtins.toString ./.}/Cargo.lock $sourceRoot/Cargo.lock - ''; - cargoLock = { - lockFile = "${builtins.toString ./.}/Cargo.lock"; + lockFile = ./Cargo.lock; }; nativeBuildInputs = [ @@ -114,7 +116,6 @@ rustPlatform.buildRustPackage { TAURI_SKIP_DEVSERVER_CHECK = "true"; preBuild = '' - # Link the pre-built frontend dist where tauri.conf.json expects it (../ from src-tauri) ln -s ${frontend} $NIX_BUILD_TOP/source/web/dist ''; @@ -153,4 +154,4 @@ rustPlatform.buildRustPackage { platforms = platforms.linux; mainProgram = "pinepods"; }; -} \ No newline at end of file +}