Skip to content

Commit

Permalink
Move src to var
Browse files Browse the repository at this point in the history
  • Loading branch information
surma committed Sep 8, 2024
1 parent 16b75e7 commit 2287e45
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 21 deletions.
10 changes: 6 additions & 4 deletions codecs/mozjpeg/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
23 changes: 16 additions & 7 deletions codecs/resize/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -43,6 +45,13 @@
};
};
};

packageVariants = forAllVariants { inherit builder variants; };
in
mkRepoBinaryUpdater {
packages = packageVariants // {
default = packageVariants."resize-squoosh-base";
};
}
);
}
19 changes: 14 additions & 5 deletions codecs/rotate/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -40,6 +42,13 @@
wasmBindgen = null;
};
};

packageVariants = forAllVariants { inherit builder variants; };
in
mkRepoBinaryUpdater {
packages = packageVariants // {
default = packageVariants."rotate-squoosh-base";
};
}
);
}
12 changes: 7 additions & 5 deletions codecs/webp/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 2287e45

Please sign in to comment.