mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-20 04:28:52 +00:00
Format everything
This commit is contained in:
@@ -20,18 +20,21 @@
|
|||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
inherit (pkgs) callPackage stdenv lib;
|
inherit (pkgs) callPackage stdenv lib;
|
||||||
|
|
||||||
buildSquooshCppCodec = callPackage (import ../../nix/squoosh-cxx-builder) {};
|
buildSquooshCppCodec = callPackage (import ../../nix/squoosh-cxx-builder) { };
|
||||||
squooshHelpers = callPackage (import ../../nix/squoosh-helpers) {};
|
squooshHelpers = callPackage (import ../../nix/squoosh-helpers) { };
|
||||||
inherit (squooshHelpers) mkInstallable forAllVariants;
|
inherit (squooshHelpers) mkInstallable forAllVariants;
|
||||||
|
|
||||||
variants = {
|
variants = {
|
||||||
base = {};
|
base = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
builder = variantName: opts: {
|
builder = variantName: opts: {
|
||||||
mozjpeg-squoosh = buildSquooshCppCodec {
|
mozjpeg-squoosh = buildSquooshCppCodec {
|
||||||
name = "mozjpeg-squoosh";
|
name = "mozjpeg-squoosh";
|
||||||
src = lib.sources.sourceByRegex ./. ["Makefile" "enc(/.+)?"];
|
src = lib.sources.sourceByRegex ./. [
|
||||||
|
"Makefile"
|
||||||
|
"enc(/.+)?"
|
||||||
|
];
|
||||||
MOZJPEG = self.packages.${system}."mozjpeg-${variantName}";
|
MOZJPEG = self.packages.${system}."mozjpeg-${variantName}";
|
||||||
|
|
||||||
dontConfigure = true;
|
dontConfigure = true;
|
||||||
@@ -75,11 +78,13 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
packageVariants = forAllVariants {inherit builder variants;};
|
packageVariants = forAllVariants { inherit builder variants; };
|
||||||
in
|
in
|
||||||
|
|
||||||
mkInstallable {
|
mkInstallable {
|
||||||
packages = packageVariants // {default = packageVariants."mozjpeg-squoosh-base";};
|
packages = packageVariants // {
|
||||||
|
default = packageVariants."mozjpeg-squoosh-base";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,15 @@
|
|||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
inherit (pkgs) callPackage lib;
|
inherit (pkgs) callPackage lib;
|
||||||
|
|
||||||
buildSquooshRustCodec= callPackage (import ../../nix/squoosh-rust-builder) {fenix = fenix.packages.${system};};
|
buildSquooshRustCodec = callPackage (import ../../nix/squoosh-rust-builder) {
|
||||||
mkInstallable = callPackage (import ../../nix/mk-installable) {};
|
fenix = fenix.packages.${system};
|
||||||
|
};
|
||||||
|
mkInstallable = callPackage (import ../../nix/mk-installable) { };
|
||||||
|
|
||||||
src = lib.sources.sourceByRegex ./. ["Makefile" "enc(/.+)?"];
|
src = lib.sources.sourceByRegex ./. [
|
||||||
|
"Makefile"
|
||||||
|
"enc(/.+)?"
|
||||||
|
];
|
||||||
in
|
in
|
||||||
mkInstallable {
|
mkInstallable {
|
||||||
packages = rec {
|
packages = rec {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/24.05";
|
nixpkgs.url = "github:nixos/nixpkgs/24.05";
|
||||||
@@ -10,7 +9,7 @@
|
|||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
flake-utils,
|
flake-utils,
|
||||||
fenix
|
fenix,
|
||||||
}:
|
}:
|
||||||
flake-utils.lib.eachDefaultSystem (
|
flake-utils.lib.eachDefaultSystem (
|
||||||
system:
|
system:
|
||||||
@@ -18,10 +17,15 @@
|
|||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
inherit (pkgs) callPackage lib;
|
inherit (pkgs) callPackage lib;
|
||||||
|
|
||||||
buildSquooshRustCodec= callPackage (import ../../nix/squoosh-rust-builder) {fenix = fenix.packages.${system};};
|
buildSquooshRustCodec = callPackage (import ../../nix/squoosh-rust-builder) {
|
||||||
mkInstallable = callPackage (import ../../nix/mk-installable) {};
|
fenix = fenix.packages.${system};
|
||||||
|
};
|
||||||
|
mkInstallable = callPackage (import ../../nix/mk-installable) { };
|
||||||
|
|
||||||
src = lib.sources.sourceByRegex ./. ["Cargo\.*" ".*\.rs"];
|
src = lib.sources.sourceByRegex ./. [
|
||||||
|
"Cargo\.*"
|
||||||
|
".*\.rs"
|
||||||
|
];
|
||||||
in
|
in
|
||||||
mkInstallable {
|
mkInstallable {
|
||||||
packages = rec {
|
packages = rec {
|
||||||
|
|||||||
@@ -19,18 +19,18 @@
|
|||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
inherit (pkgs) lib stdenv callPackage;
|
inherit (pkgs) lib stdenv callPackage;
|
||||||
buildSquooshCppCodec = callPackage (import ../../nix/squoosh-cxx-builder) {};
|
buildSquooshCppCodec = callPackage (import ../../nix/squoosh-cxx-builder) { };
|
||||||
squooshHelpers = callPackage (import ../../nix/squoosh-helpers) {};
|
squooshHelpers = callPackage (import ../../nix/squoosh-helpers) { };
|
||||||
inherit (squooshHelpers) mkInstallable forAllVariants;
|
inherit (squooshHelpers) mkInstallable forAllVariants;
|
||||||
|
|
||||||
variants = {
|
variants = {
|
||||||
base = {
|
base = {
|
||||||
simd = false;
|
simd = false;
|
||||||
|
};
|
||||||
|
simd = {
|
||||||
|
simd = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
simd = {
|
|
||||||
simd = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
builder =
|
builder =
|
||||||
variantName:
|
variantName:
|
||||||
@@ -38,7 +38,11 @@
|
|||||||
{
|
{
|
||||||
"webp-squoosh" = buildSquooshCppCodec {
|
"webp-squoosh" = buildSquooshCppCodec {
|
||||||
name = "webp-squoosh-${variantName}";
|
name = "webp-squoosh-${variantName}";
|
||||||
src = lib.sources.sourceByRegex ./. ["Makefile" "enc(/.+)?" "dec(/.+)?"];
|
src = lib.sources.sourceByRegex ./. [
|
||||||
|
"Makefile"
|
||||||
|
"enc(/.+)?"
|
||||||
|
"dec(/.+)?"
|
||||||
|
];
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
pkgs.emscripten
|
pkgs.emscripten
|
||||||
self.packages.${system}."webp-${variantName}"
|
self.packages.${system}."webp-${variantName}"
|
||||||
@@ -95,25 +99,30 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
packageVariants = forAllVariants {
|
packageVariants = forAllVariants { inherit builder variants; };
|
||||||
inherit builder variants;
|
|
||||||
};
|
|
||||||
|
|
||||||
defaultPackage = let
|
defaultPackage =
|
||||||
copyAllCodecs = lib.concatLines (lib.mapAttrsToList (name: _: "cp -r ${packageVariants."webp-squoosh-${name}"} $out/${name}") variants);
|
let
|
||||||
in
|
copyAllCodecs = lib.concatLines (
|
||||||
stdenv.mkDerivation {
|
lib.mapAttrsToList (
|
||||||
name = "all-variants";
|
name: _: "cp -r ${packageVariants."webp-squoosh-${name}"} $out/${name}"
|
||||||
phases = ["buildPhase"];
|
) variants
|
||||||
buildPhase = ''
|
);
|
||||||
mkdir -p $out;
|
in
|
||||||
${copyAllCodecs}
|
stdenv.mkDerivation {
|
||||||
'';
|
name = "all-variants";
|
||||||
};
|
phases = [ "buildPhase" ];
|
||||||
|
buildPhase = ''
|
||||||
|
mkdir -p $out;
|
||||||
|
${copyAllCodecs}
|
||||||
|
'';
|
||||||
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
mkInstallable {
|
mkInstallable {
|
||||||
packages = packageVariants // {default = defaultPackage;};
|
packages = packageVariants // {
|
||||||
|
default = defaultPackage;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user