Format everything

This commit is contained in:
Surma
2024-09-08 13:18:41 +01:00
parent d895e0a6b6
commit 8a1c95b7dc
4 changed files with 64 additions and 41 deletions

View File

@@ -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;
@@ -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";
};
}
);
}

View File

@@ -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 {

View File

@@ -1,4 +1,3 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/24.05";
@@ -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 {

View File

@@ -19,18 +19,18 @@
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;
variants = {
base = {
simd = false;
};
simd = {
simd = true;
};
};
simd = {
simd = true;
};
};
builder =
variantName:
@@ -38,7 +38,11 @@
{
"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}"
@@ -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;
};
}
);
}