diff --git a/codecs/mozjpeg/flake.nix b/codecs/mozjpeg/flake.nix index b751710a..0d155164 100644 --- a/codecs/mozjpeg/flake.nix +++ b/codecs/mozjpeg/flake.nix @@ -28,13 +28,15 @@ base = { }; }; + src = lib.sources.sourceByRegex ./. [ + "Makefile" + "enc(/.+)?" + ]; + builder = variantName: opts: { mozjpeg-squoosh = buildSquooshCppCodec { name = "mozjpeg-squoosh"; - src = lib.sources.sourceByRegex ./. [ - "Makefile" - "enc(/.+)?" - ]; + inherit src; MOZJPEG = self.packages.${system}."mozjpeg-${variantName}"; dontConfigure = true; diff --git a/codecs/resize/flake.nix b/codecs/resize/flake.nix index 89ed870e..722bd4b2 100644 --- a/codecs/resize/flake.nix +++ b/codecs/resize/flake.nix @@ -21,17 +21,19 @@ fenix = fenix.packages.${system}; }; squooshHelpers = callPackage (import ../../nix/squoosh-helpers) { }; - inherit (squooshHelpers) mkRepoBinaryUpdater; + inherit (squooshHelpers) mkRepoBinaryUpdater forAllVariants; + + variants = { + base = { }; + }; src = lib.sources.sourceByRegex ./. [ "Cargo.*" - ".*\.rs" - "src" + "build\.rs" + "src(/.+)?" ]; - in - mkRepoBinaryUpdater { - packages = rec { - default = resize-squoosh; + + builder = variantName: opts: { resize-squoosh = buildSquooshRustCodec { name = "resize-squoosh"; inherit src; @@ -43,6 +45,13 @@ }; }; }; + + packageVariants = forAllVariants { inherit builder variants; }; + in + mkRepoBinaryUpdater { + packages = packageVariants // { + default = packageVariants."resize-squoosh-base"; + }; } ); } diff --git a/codecs/rotate/flake.nix b/codecs/rotate/flake.nix index 3ecdb721..98038aad 100644 --- a/codecs/rotate/flake.nix +++ b/codecs/rotate/flake.nix @@ -21,16 +21,18 @@ fenix = fenix.packages.${system}; }; squooshHelpers = callPackage (import ../../nix/squoosh-helpers) { }; - inherit (squooshHelpers) mkRepoBinaryUpdater; + inherit (squooshHelpers) mkRepoBinaryUpdater forAllVariants; + + variants = { + base = { }; + }; src = lib.sources.sourceByRegex ./. [ "Cargo\.*" ".*\.rs" ]; - in - mkRepoBinaryUpdater { - packages = rec { - default = rotate-squoosh; + + builder = variantName: opts: { rotate-squoosh = buildSquooshRustCodec { name = "rotate-squoosh"; inherit src; @@ -40,6 +42,13 @@ wasmBindgen = null; }; }; + + packageVariants = forAllVariants { inherit builder variants; }; + in + mkRepoBinaryUpdater { + packages = packageVariants // { + default = packageVariants."rotate-squoosh-base"; + }; } ); } diff --git a/codecs/webp/flake.nix b/codecs/webp/flake.nix index cf036d5c..ce875e30 100644 --- a/codecs/webp/flake.nix +++ b/codecs/webp/flake.nix @@ -32,17 +32,19 @@ }; }; + src = lib.sources.sourceByRegex ./. [ + "Makefile" + "enc(/.+)?" + "dec(/.+)?" + ]; + builder = variantName: { simd }: { "webp-squoosh" = buildSquooshCppCodec { name = "webp-squoosh-${variantName}"; - src = lib.sources.sourceByRegex ./. [ - "Makefile" - "enc(/.+)?" - "dec(/.+)?" - ]; + inherit src; nativeBuildInputs = [ pkgs.emscripten self.packages.${system}."webp-${variantName}"