diff --git a/README.md b/README.md index e59a5e737..ef1c6264d 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ However, Squoosh utilizes Google Analytics to collect the following: # Developing +## Web App + To develop for Squoosh: 1. Clone the repository @@ -31,8 +33,28 @@ To develop for Squoosh: npm run dev ``` +## Codecs + +All build instructions for codecs are written using [Nix]. If you have Nix installed, you can rebuild the WebAssembly binaries by running: + +```sh +# Build the codec +cd codec/ +nix run '.#updateRepoBinaries' +``` + +If you do not have Nix installed, you can use the provided Docker image to create a shell with nix available: + +```sh +# Build the image (only needs to be done once). +docker build -t squoosh-nix ./nix +docker run --name squoosh-nix -ti -v $PWD:/app squoosh-nix /bin/sh +# ... continue with the steps above +``` + # Contributing Squoosh is an open-source project that appreciates all community involvement. To contribute to the project, follow the [contribute guide](/CONTRIBUTING.md). [squoosh]: https://squoosh.app +[nix]: https://nixos.org diff --git a/nix/Dockerfile b/nix/Dockerfile new file mode 100644 index 000000000..75dadab45 --- /dev/null +++ b/nix/Dockerfile @@ -0,0 +1,10 @@ +FROM nixos/nix:2.24.5 + +RUN <> /etc/nix/nix.conf << EOL +experimental-features = nix-command flakes +EOL +EOF + +WORKDIR /app +CMD ["nix", "run", ".#updateRepoBinaries"] diff --git a/nix/rust-helpers/default.nix b/nix/rust-helpers/default.nix index 1fb69df53..c5cbcfc69 100644 --- a/nix/rust-helpers/default.nix +++ b/nix/rust-helpers/default.nix @@ -2,7 +2,10 @@ rustPlatform, jq, rsync, + lib, stdenv, + # openssl, + pkg-config, fenix, }: { @@ -40,6 +43,11 @@ toolchain jq rsync + pkg-config + # (lib.getDev openssl) + ]; + buildInputs = [ + # openssl ]; dontConfigure = true; buildPhase = '' diff --git a/nix/wasm-bindgen/default.nix b/nix/wasm-bindgen/default.nix index 0fb20b725..e32de9c19 100644 --- a/nix/wasm-bindgen/default.nix +++ b/nix/wasm-bindgen/default.nix @@ -3,6 +3,9 @@ fetchCrate, rustPlatform, curl, + stdenv, + openssl_1_1, + pkg-config, darwin, }: rec { @@ -21,10 +24,15 @@ rec { rustPlatform.buildRustPackage { name = "wasm-bindgen-cli"; inherit src cargoLock; + nativeBuildInputs = [ + pkg-config + ]; buildInputs = [ - curl - darwin.apple_sdk.frameworks.Security + openssl_1_1 + ] ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.IOKit ]; + doCheck = false; };