diff --git a/codecs/resize/flake.lock b/codecs/resize/flake.lock new file mode 100644 index 00000000..4651a962 --- /dev/null +++ b/codecs/resize/flake.lock @@ -0,0 +1,147 @@ +{ + "nodes": { + "fenix": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1723012113, + "narHash": "sha256-AJGsmwDnheWMjZWUqgiGtBjbxMmvLvMp5WJhmTRhJ4w=", + "owner": "nix-community", + "repo": "fenix", + "rev": "3dab4ada5b0c5a22d56dbfd7e140c16f3df2e69a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1721727458, + "narHash": "sha256-r/xppY958gmZ4oTfLiHN0ZGuQ+RSTijDblVgVLFi1mw=", + "owner": "nix-community", + "repo": "naersk", + "rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1722813957, + "narHash": "sha256-IAoYyYnED7P8zrBFMnmp7ydaJfwTnwcnqxUElC1I26Y=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "cb9a96f23c491c081b38eab96d22fa958043c9fa", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1723019560, + "narHash": "sha256-O/kxmybNecC3Efr6ITOdtCzFv90/B2Iiedavj5aRWt0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f5129fb42b9c262318130a97b47516946da3e7d7", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1717179513, + "narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "fenix": "fenix", + "flake-utils": "flake-utils", + "naersk": "naersk", + "nixpkgs": "nixpkgs_3" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1722925734, + "narHash": "sha256-5maDP51jkTUCHDU7tKdbsMQTk0QMNZjNGZw2z++YaaI=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "b23142209ef632475915e858f5f20901ef7c12da", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/codecs/resize/flake.nix b/codecs/resize/flake.nix new file mode 100644 index 00000000..0e5200c5 --- /dev/null +++ b/codecs/resize/flake.nix @@ -0,0 +1,58 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/24.05"; + flake-utils.url = "github:numtide/flake-utils"; + fenix.url = "github:nix-community/fenix"; + naersk.url = "github:nix-community/naersk"; + }; + outputs = + { + self, + nixpkgs, + flake-utils, + fenix, + naersk, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + target = "wasm32-unknown-unknown"; + pkgs = nixpkgs.legacyPackages.${system}; + toolchain = + with fenix.packages.${system}; + combine [ + stable.rustc + stable.cargo + targets.${target}.stable.rust-std + ]; + naersk' = pkgs.callPackage naersk { + rustc = toolchain; + cargo = toolchain; + }; + in + with pkgs; + { + packages = rec { + default = resize-squoosh; + resize-squoosh = naersk'.buildPackage { + name = "squoosh-resize"; + src = ./.; + release = true; + copyLibs = true; + CARGO_BUILD_TARGET = target; + }; + + installScript = writeShellScriptBin "install.sh" '' + ${pkgs.coreutils}/bin/mkdir -p wasm_build + ${pkgs.rsync}/bin/rsync --chmod=u+w -r ${self.packages.${system}.resize-squoosh}/* wasm_build/ + ''; + }; + apps = { + install = { + type = "app"; + program = "${self.packages.${system}.installScript}/bin/install.sh"; + }; + }; + } + ); +}