mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-20 12:38:50 +00:00
Move away from subflakes
This commit is contained in:
55
nix/wasm-bindgen/default.nix
Normal file
55
nix/wasm-bindgen/default.nix
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
lib,
|
||||
fetchCrate,
|
||||
rustPlatform,
|
||||
curl,
|
||||
darwin,
|
||||
}:
|
||||
rec {
|
||||
build =
|
||||
{ version, sha256 }:
|
||||
let
|
||||
src = fetchCrate {
|
||||
pname = "wasm-bindgen-cli";
|
||||
inherit version sha256;
|
||||
};
|
||||
|
||||
cargoLock = {
|
||||
lockFile = "${src}/Cargo.lock";
|
||||
};
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
name = "wasm-bindgen-cli";
|
||||
inherit src cargoLock;
|
||||
buildInputs = [
|
||||
curl
|
||||
darwin.apple_sdk.frameworks.Security
|
||||
];
|
||||
doCheck = false;
|
||||
};
|
||||
|
||||
buildFromCargoLock =
|
||||
{
|
||||
system,
|
||||
cargoLock,
|
||||
sha256,
|
||||
}:
|
||||
assert (cargoLock.lockFile or null == null) != (cargoLock.lockFileContents or null == null);
|
||||
let
|
||||
lockFileContents =
|
||||
if cargoLock.lockFile != null then
|
||||
builtins.readFile cargoLock.lockFile
|
||||
else
|
||||
cargoLock.lockFileContents;
|
||||
|
||||
parsedLockFile = builtins.fromTOML lockFileContents;
|
||||
|
||||
wasm-bindgen-version =
|
||||
(lib.lists.findFirst (x: x.name == "wasm-bindgen") null parsedLockFile.package).version;
|
||||
in
|
||||
assert wasm-bindgen-version != null;
|
||||
build {
|
||||
inherit system sha256;
|
||||
version = wasm-bindgen-version;
|
||||
};
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
{
|
||||
outputs =
|
||||
{ self, nixpkgs }:
|
||||
{
|
||||
lib = {
|
||||
build =
|
||||
{
|
||||
system,
|
||||
version,
|
||||
sha256,
|
||||
}:
|
||||
with nixpkgs.legacyPackages.${system};
|
||||
let
|
||||
src = pkgs.fetchCrate {
|
||||
pname = "wasm-bindgen-cli";
|
||||
inherit version sha256;
|
||||
};
|
||||
|
||||
cargoLock = {
|
||||
lockFile = "${src}/Cargo.lock";
|
||||
};
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
name = "wasm-bindgen-cli";
|
||||
inherit src cargoLock;
|
||||
buildInputs = [
|
||||
curl
|
||||
darwin.apple_sdk.frameworks.Security
|
||||
];
|
||||
doCheck = false;
|
||||
};
|
||||
|
||||
buildFromCargoLock =
|
||||
{
|
||||
system,
|
||||
cargoLock,
|
||||
sha256,
|
||||
}:
|
||||
with nixpkgs.legacyPackages.${system};
|
||||
assert (cargoLock.lockFile or null == null) != (cargoLock.lockFileContents or null == null);
|
||||
let
|
||||
lockFileContents =
|
||||
if cargoLock.lockFile != null then
|
||||
builtins.readFile cargoLock.lockFile
|
||||
else
|
||||
cargoLock.lockFileContents;
|
||||
|
||||
parsedLockFile = builtins.fromTOML lockFileContents;
|
||||
|
||||
wasm-bindgen-version =
|
||||
(lib.lists.findFirst (x: x.name == "wasm-bindgen") null parsedLockFile.package).version;
|
||||
in
|
||||
assert wasm-bindgen-version != null;
|
||||
self.lib.build {
|
||||
inherit system sha256;
|
||||
version = wasm-bindgen-version;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user