Skip to content

Commit

Permalink
Format everything
Browse files Browse the repository at this point in the history
  • Loading branch information
surma committed Sep 8, 2024
1 parent d895e0a commit 8a1c95b
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 41 deletions.
19 changes: 12 additions & 7 deletions codecs/mozjpeg/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) callPackage stdenv lib;

buildSquooshCppCodec = callPackage (import ../../nix/squoosh-cxx-builder) {};
squooshHelpers = callPackage (import ../../nix/squoosh-helpers) {};
buildSquooshCppCodec = callPackage (import ../../nix/squoosh-cxx-builder) { };
squooshHelpers = callPackage (import ../../nix/squoosh-helpers) { };
inherit (squooshHelpers) mkInstallable forAllVariants;

variants = {
base = {};
base = { };
};

builder = variantName: opts: {
mozjpeg-squoosh = buildSquooshCppCodec {
name = "mozjpeg-squoosh";
src = lib.sources.sourceByRegex ./. ["Makefile" "enc(/.+)?"];
src = lib.sources.sourceByRegex ./. [
"Makefile"
"enc(/.+)?"
];
MOZJPEG = self.packages.${system}."mozjpeg-${variantName}";

dontConfigure = true;
Expand Down Expand Up @@ -73,13 +76,15 @@
'';
dontFixup = true;
};
};
};

packageVariants = forAllVariants {inherit builder variants;};
packageVariants = forAllVariants { inherit builder variants; };
in

mkInstallable {
packages = packageVariants // {default = packageVariants."mozjpeg-squoosh-base";};
packages = packageVariants // {
default = packageVariants."mozjpeg-squoosh-base";
};
}
);
}
11 changes: 8 additions & 3 deletions codecs/resize/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) callPackage lib;

buildSquooshRustCodec= callPackage (import ../../nix/squoosh-rust-builder) {fenix = fenix.packages.${system};};
mkInstallable = callPackage (import ../../nix/mk-installable) {};
buildSquooshRustCodec = callPackage (import ../../nix/squoosh-rust-builder) {
fenix = fenix.packages.${system};
};
mkInstallable = callPackage (import ../../nix/mk-installable) { };

src = lib.sources.sourceByRegex ./. ["Makefile" "enc(/.+)?"];
src = lib.sources.sourceByRegex ./. [
"Makefile"
"enc(/.+)?"
];
in
mkInstallable {
packages = rec {
Expand Down
16 changes: 10 additions & 6 deletions codecs/rotate/flake.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/24.05";
Expand All @@ -10,18 +9,23 @@
self,
nixpkgs,
flake-utils,
fenix
fenix,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) callPackage lib;

buildSquooshRustCodec= callPackage (import ../../nix/squoosh-rust-builder) {fenix = fenix.packages.${system};};
mkInstallable = callPackage (import ../../nix/mk-installable) {};

src = lib.sources.sourceByRegex ./. ["Cargo\.*" ".*\.rs"];
buildSquooshRustCodec = callPackage (import ../../nix/squoosh-rust-builder) {
fenix = fenix.packages.${system};
};
mkInstallable = callPackage (import ../../nix/mk-installable) { };

src = lib.sources.sourceByRegex ./. [
"Cargo\.*"
".*\.rs"
];
in
mkInstallable {
packages = rec {
Expand Down
59 changes: 34 additions & 25 deletions codecs/webp/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,30 @@
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib stdenv callPackage;
buildSquooshCppCodec = callPackage (import ../../nix/squoosh-cxx-builder) {};
squooshHelpers = callPackage (import ../../nix/squoosh-helpers) {};
buildSquooshCppCodec = callPackage (import ../../nix/squoosh-cxx-builder) { };
squooshHelpers = callPackage (import ../../nix/squoosh-helpers) { };
inherit (squooshHelpers) mkInstallable forAllVariants;

variants = {
base = {
simd = false;
};
simd = {
simd = true;
variants = {
base = {
simd = false;
};
simd = {
simd = true;
};
};
};

builder =
variantName:
{ simd }:
{
"webp-squoosh" = buildSquooshCppCodec {
name = "webp-squoosh-${variantName}";
src = lib.sources.sourceByRegex ./. ["Makefile" "enc(/.+)?" "dec(/.+)?"];
src = lib.sources.sourceByRegex ./. [
"Makefile"
"enc(/.+)?"
"dec(/.+)?"
];
nativeBuildInputs = [
pkgs.emscripten
self.packages.${system}."webp-${variantName}"
Expand Down Expand Up @@ -95,25 +99,30 @@
};
};

packageVariants = forAllVariants {
inherit builder variants;
};
packageVariants = forAllVariants { inherit builder variants; };

defaultPackage = let
copyAllCodecs = lib.concatLines (lib.mapAttrsToList (name: _: "cp -r ${packageVariants."webp-squoosh-${name}"} $out/${name}") variants);
in
stdenv.mkDerivation {
name = "all-variants";
phases = ["buildPhase"];
buildPhase = ''
mkdir -p $out;
${copyAllCodecs}
'';
};
defaultPackage =
let
copyAllCodecs = lib.concatLines (
lib.mapAttrsToList (
name: _: "cp -r ${packageVariants."webp-squoosh-${name}"} $out/${name}"
) variants
);
in
stdenv.mkDerivation {
name = "all-variants";
phases = [ "buildPhase" ];
buildPhase = ''
mkdir -p $out;
${copyAllCodecs}
'';
};
in

mkInstallable {
packages = packageVariants // {default = defaultPackage;};
packages = packageVariants // {
default = defaultPackage;
};
}
);
}

0 comments on commit 8a1c95b

Please sign in to comment.