From 4f93abb10520c2d966ad4d14c98b10aa803712ca Mon Sep 17 00:00:00 2001 From: Surma Date: Fri, 6 Sep 2024 17:54:54 +0100 Subject: [PATCH] Update resize codec build --- codecs/resize/flake.lock | 140 ++---------------- codecs/resize/flake.nix | 30 ++-- .../resize/wasm_build/squoosh_resize_bg.wasm | Bin 36811 -> 36811 bytes nix/squoosh-codec-builders/default.nix | 18 ++- nix/wasm-bindgen/default.nix | 8 +- 5 files changed, 40 insertions(+), 156 deletions(-) diff --git a/codecs/resize/flake.lock b/codecs/resize/flake.lock index 9d0a505b4..4b97d4ab1 100644 --- a/codecs/resize/flake.lock +++ b/codecs/resize/flake.lock @@ -2,7 +2,7 @@ "nodes": { "fenix": { "inputs": { - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs", "rust-analyzer-src": "rust-analyzer-src" }, "locked": { @@ -14,28 +14,10 @@ "type": "github" }, "original": { - "owner": "nix-community", - "repo": "fenix", - "type": "github" - } - }, - "fenix_2": { - "inputs": { - "nixpkgs": "nixpkgs_3", - "rust-analyzer-src": "rust-analyzer-src_2" - }, - "locked": { - "lastModified": 1723616992, - "narHash": "sha256-jDHYfEECzFwZm4huz7AbPjlH3jJ4/2ns9PddtFA5XMY=", "owner": "nix-community", "repo": "fenix", "rev": "7bad6c7ff73b784a9c7de9147626c8d5d5072809", "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "fenix", - "type": "github" } }, "flake-utils": { @@ -58,27 +40,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1717179513, - "narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "24.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1723362943, - "narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=", + "lastModified": 1725432240, + "narHash": "sha256-+yj+xgsfZaErbfYM3T+QvEE2hU7UuE+Jf0fJCJ8uPS0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a58bc8ad779655e790115244571758e8de055e3d", + "rev": "ad416d066ca1222956472ab7d0555a6946746a80", "type": "github" }, "original": { @@ -88,39 +54,37 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_2": { "locked": { - "lastModified": 1723362943, - "narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=", + "lastModified": 1717179513, + "narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a58bc8ad779655e790115244571758e8de055e3d", + "rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-unstable", + "ref": "24.05", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { + "fenix": "fenix", "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "rust-helpers": "rust-helpers", - "squoosh-codec-builders": "squoosh-codec-builders", - "wasm-bindgen": "wasm-bindgen" + "nixpkgs": "nixpkgs_2" } }, "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1723561310, - "narHash": "sha256-a3KMMsIDvdo+ClLabh5wfJoa17YTSvy2wDLb8yZCXvc=", + "lastModified": 1725548942, + "narHash": "sha256-ZnF5MaOAeiiKIATYN4rrqNsnhSQOQ+Hvfg0mHLvN04Y=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "78c2bdce860dbd996a8083224d01a96660dd6a15", + "rev": "124c7482167ff6eea4f7663c0be87ea568ccd8c6", "type": "github" }, "original": { @@ -130,65 +94,6 @@ "type": "github" } }, - "rust-analyzer-src_2": { - "flake": false, - "locked": { - "lastModified": 1723561310, - "narHash": "sha256-a3KMMsIDvdo+ClLabh5wfJoa17YTSvy2wDLb8yZCXvc=", - "owner": "rust-lang", - "repo": "rust-analyzer", - "rev": "78c2bdce860dbd996a8083224d01a96660dd6a15", - "type": "github" - }, - "original": { - "owner": "rust-lang", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" - } - }, - "rust-helpers": { - "inputs": { - "fenix": "fenix", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1, - "narHash": "sha256-PvUYYFjHMePbyU/CWQa3uIZB+3YNz+SMtuekxTChdyE=", - "path": "../../nix/rust-helpers", - "type": "path" - }, - "original": { - "path": "../../nix/rust-helpers", - "type": "path" - } - }, - "squoosh-codec-builders": { - "inputs": { - "fenix": "fenix_2", - "nixpkgs": [ - "nixpkgs" - ], - "rust-helpers": [ - "rust-helpers" - ], - "wasm-bindgen": [ - "wasm-bindgen" - ] - }, - "locked": { - "lastModified": 1, - "narHash": "sha256-OBp4z5JBmhbxEKPmfD0YLAxn3TeMYhO4yhyMRbj0b1E=", - "path": "../../nix/squoosh-codec-builders", - "type": "path" - }, - "original": { - "path": "../../nix/squoosh-codec-builders", - "type": "path" - } - }, "systems": { "locked": { "lastModified": 1681028828, @@ -203,23 +108,6 @@ "repo": "default", "type": "github" } - }, - "wasm-bindgen": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1, - "narHash": "sha256-uszruLy8B1/xmT7lKjAuKPdxLr6qGqOI32H767V590g=", - "path": "../../nix/wasm-bindgen", - "type": "path" - }, - "original": { - "path": "../../nix/wasm-bindgen", - "type": "path" - } } }, "root": "root", diff --git a/codecs/resize/flake.nix b/codecs/resize/flake.nix index aca6636ec..6d98ca97f 100644 --- a/codecs/resize/flake.nix +++ b/codecs/resize/flake.nix @@ -2,45 +2,37 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/24.05"; flake-utils.url = "github:numtide/flake-utils"; - wasm-bindgen = { - url = "path:../../nix/wasm-bindgen"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - rust-helpers = { - url = "path:../../nix/rust-helpers"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - squoosh-codec-builders = { - url = "path:../../nix/squoosh-codec-builders"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.rust-helpers.follows = "rust-helpers"; - inputs.wasm-bindgen.follows = "wasm-bindgen"; - }; + fenix.url = "github:nix-community/fenix/7bad6c7ff73b784a9c7de9147626c8d5d5072809"; }; outputs = { self, nixpkgs, flake-utils, - squoosh-codec-builders, - ... + fenix, }: flake-utils.lib.eachDefaultSystem ( system: - with nixpkgs.legacyPackages.${system}; let + pkgs = nixpkgs.legacyPackages.${system}; + inherit (pkgs) callPackage writeShellScriptBin; + + squooshCodecBuilders = callPackage (import ../../nix/squoosh-codec-builders) {fenix = fenix.packages.${system};}; + src = ./.; in { packages = rec { default = resize-squoosh; - resize-squoosh = squoosh-codec-builders.lib.buildSquooshCodecRust { + resize-squoosh = squooshCodecBuilders.buildSquooshCodecRust { name = "resize-squoosh"; inherit system src; cargoLock = { lockFile = "${src}/Cargo.lock"; }; - wasmBindgenSha = "sha256-HTElSB76gqCpDu8S0ZJlfd/S4ftMrbwxFgJM9OXBRz8="; + wasmBindgen = { + sha256 = "sha256-HTElSB76gqCpDu8S0ZJlfd/S4ftMrbwxFgJM9OXBRz8="; + }; }; installScript = writeShellScriptBin "install.sh" '' diff --git a/codecs/resize/wasm_build/squoosh_resize_bg.wasm b/codecs/resize/wasm_build/squoosh_resize_bg.wasm index 7152e078f848506fc0a512e53d4c5c7ed06f68da..d37ebb14e1c64d7797b785af5e011ba9a03dc39f 100644 GIT binary patch delta 47 zcmX>-pXu~`rVXpg6f(2R^RkPx^Nb9O3k!|Sk~1t4%}w*NEGjJ03yYJ>%r>7YW0V8{ D(Yg{* delta 47 zcmX>-pXu~`rVXpg6be#|GO7%XO*1NT3o~Emm diff --git a/nix/squoosh-codec-builders/default.nix b/nix/squoosh-codec-builders/default.nix index 7e63db73f..77a95fb48 100644 --- a/nix/squoosh-codec-builders/default.nix +++ b/nix/squoosh-codec-builders/default.nix @@ -1,9 +1,14 @@ { + pkgs, fenix, - wasm-bindgen, - rust-helpers, + wasm-bindgen ? pkgs.callPackage (import ../wasm-bindgen) { }, + rust-helpers ? pkgs.callPackage (import ../rust-helpers) { inherit fenix; }, stdenv, }: +let + inherit (rust-helpers) buildRustPackage; +in + { buildSquooshCodecRust = { @@ -18,20 +23,23 @@ ... }@args: let - codecBuild = rust-helpers.lib.buildRustPackage { + codecBuild = buildRustPackage { inherit src cargoLock; name = "${name}-codec"; target = "wasm32-unknown-unknown"; }; - wasm-bindgen-bin = wasm-bindgen.lib.buildFromCargoLock { + wasm-bindgen-bin = wasm-bindgen.buildFromCargoLock { inherit cargoLock; sha256 = wasmBindgen.sha256; }; in if wasmBindgen != null then stdenv.mkDerivation ( - (removeAttrs args [ "cargoLock" ]) + (removeAttrs args [ + "cargoLock" + "wasmBindgen" + ]) // { inherit codecBuild; dontConfigure = true; diff --git a/nix/wasm-bindgen/default.nix b/nix/wasm-bindgen/default.nix index 9e7518027..0fb20b725 100644 --- a/nix/wasm-bindgen/default.nix +++ b/nix/wasm-bindgen/default.nix @@ -29,11 +29,7 @@ rec { }; buildFromCargoLock = - { - system, - cargoLock, - sha256, - }: + { cargoLock, sha256 }: assert (cargoLock.lockFile or null == null) != (cargoLock.lockFileContents or null == null); let lockFileContents = @@ -49,7 +45,7 @@ rec { in assert wasm-bindgen-version != null; build { - inherit system sha256; + inherit sha256; version = wasm-bindgen-version; }; }