Update resize codec build

This commit is contained in:
Surma
2024-09-06 17:54:54 +01:00
parent 738d07d98a
commit 4f93abb105
5 changed files with 48 additions and 164 deletions

156
codecs/resize/flake.lock generated
View File

@@ -2,7 +2,7 @@
"nodes": { "nodes": {
"fenix": { "fenix": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs",
"rust-analyzer-src": "rust-analyzer-src" "rust-analyzer-src": "rust-analyzer-src"
}, },
"locked": { "locked": {
@@ -14,28 +14,10 @@
"type": "github" "type": "github"
}, },
"original": { "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", "owner": "nix-community",
"repo": "fenix", "repo": "fenix",
"rev": "7bad6c7ff73b784a9c7de9147626c8d5d5072809", "rev": "7bad6c7ff73b784a9c7de9147626c8d5d5072809",
"type": "github" "type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
} }
}, },
"flake-utils": { "flake-utils": {
@@ -57,6 +39,22 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1725432240,
"narHash": "sha256-+yj+xgsfZaErbfYM3T+QvEE2hU7UuE+Jf0fJCJ8uPS0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ad416d066ca1222956472ab7d0555a6946746a80",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1717179513, "lastModified": 1717179513,
"narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=", "narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=",
@@ -72,55 +70,21 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": {
"locked": {
"lastModified": 1723362943,
"narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a58bc8ad779655e790115244571758e8de055e3d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1723362943,
"narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a58bc8ad779655e790115244571758e8de055e3d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"fenix": "fenix",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs_2"
"rust-helpers": "rust-helpers",
"squoosh-codec-builders": "squoosh-codec-builders",
"wasm-bindgen": "wasm-bindgen"
} }
}, },
"rust-analyzer-src": { "rust-analyzer-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1723561310, "lastModified": 1725548942,
"narHash": "sha256-a3KMMsIDvdo+ClLabh5wfJoa17YTSvy2wDLb8yZCXvc=", "narHash": "sha256-ZnF5MaOAeiiKIATYN4rrqNsnhSQOQ+Hvfg0mHLvN04Y=",
"owner": "rust-lang", "owner": "rust-lang",
"repo": "rust-analyzer", "repo": "rust-analyzer",
"rev": "78c2bdce860dbd996a8083224d01a96660dd6a15", "rev": "124c7482167ff6eea4f7663c0be87ea568ccd8c6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -130,65 +94,6 @@
"type": "github" "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": { "systems": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
@@ -203,23 +108,6 @@
"repo": "default", "repo": "default",
"type": "github" "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", "root": "root",

View File

@@ -2,45 +2,37 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/24.05"; nixpkgs.url = "github:nixos/nixpkgs/24.05";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
wasm-bindgen = { fenix.url = "github:nix-community/fenix/7bad6c7ff73b784a9c7de9147626c8d5d5072809";
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";
};
}; };
outputs = outputs =
{ {
self, self,
nixpkgs, nixpkgs,
flake-utils, flake-utils,
squoosh-codec-builders, fenix,
...
}: }:
flake-utils.lib.eachDefaultSystem ( flake-utils.lib.eachDefaultSystem (
system: system:
with nixpkgs.legacyPackages.${system};
let let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) callPackage writeShellScriptBin;
squooshCodecBuilders = callPackage (import ../../nix/squoosh-codec-builders) {fenix = fenix.packages.${system};};
src = ./.; src = ./.;
in in
{ {
packages = rec { packages = rec {
default = resize-squoosh; default = resize-squoosh;
resize-squoosh = squoosh-codec-builders.lib.buildSquooshCodecRust { resize-squoosh = squooshCodecBuilders.buildSquooshCodecRust {
name = "resize-squoosh"; name = "resize-squoosh";
inherit system src; inherit system src;
cargoLock = { cargoLock = {
lockFile = "${src}/Cargo.lock"; lockFile = "${src}/Cargo.lock";
}; };
wasmBindgenSha = "sha256-HTElSB76gqCpDu8S0ZJlfd/S4ftMrbwxFgJM9OXBRz8="; wasmBindgen = {
sha256 = "sha256-HTElSB76gqCpDu8S0ZJlfd/S4ftMrbwxFgJM9OXBRz8=";
};
}; };
installScript = writeShellScriptBin "install.sh" '' installScript = writeShellScriptBin "install.sh" ''

View File

@@ -1,9 +1,14 @@
{ {
pkgs,
fenix, fenix,
wasm-bindgen, wasm-bindgen ? pkgs.callPackage (import ../wasm-bindgen) { },
rust-helpers, rust-helpers ? pkgs.callPackage (import ../rust-helpers) { inherit fenix; },
stdenv, stdenv,
}: }:
let
inherit (rust-helpers) buildRustPackage;
in
{ {
buildSquooshCodecRust = buildSquooshCodecRust =
{ {
@@ -18,20 +23,23 @@
... ...
}@args: }@args:
let let
codecBuild = rust-helpers.lib.buildRustPackage { codecBuild = buildRustPackage {
inherit src cargoLock; inherit src cargoLock;
name = "${name}-codec"; name = "${name}-codec";
target = "wasm32-unknown-unknown"; target = "wasm32-unknown-unknown";
}; };
wasm-bindgen-bin = wasm-bindgen.lib.buildFromCargoLock { wasm-bindgen-bin = wasm-bindgen.buildFromCargoLock {
inherit cargoLock; inherit cargoLock;
sha256 = wasmBindgen.sha256; sha256 = wasmBindgen.sha256;
}; };
in in
if wasmBindgen != null then if wasmBindgen != null then
stdenv.mkDerivation ( stdenv.mkDerivation (
(removeAttrs args [ "cargoLock" ]) (removeAttrs args [
"cargoLock"
"wasmBindgen"
])
// { // {
inherit codecBuild; inherit codecBuild;
dontConfigure = true; dontConfigure = true;

View File

@@ -29,11 +29,7 @@ rec {
}; };
buildFromCargoLock = buildFromCargoLock =
{ { cargoLock, sha256 }:
system,
cargoLock,
sha256,
}:
assert (cargoLock.lockFile or null == null) != (cargoLock.lockFileContents or null == null); assert (cargoLock.lockFile or null == null) != (cargoLock.lockFileContents or null == null);
let let
lockFileContents = lockFileContents =
@@ -49,7 +45,7 @@ rec {
in in
assert wasm-bindgen-version != null; assert wasm-bindgen-version != null;
build { build {
inherit system sha256; inherit sha256;
version = wasm-bindgen-version; version = wasm-bindgen-version;
}; };
} }