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

@@ -31,7 +31,10 @@
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;
@@ -79,7 +82,9 @@
in in
mkInstallable { 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}; 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) {
fenix = fenix.packages.${system};
};
mkInstallable = callPackage (import ../../nix/mk-installable) { }; 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 {

View File

@@ -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) {
fenix = fenix.packages.${system};
};
mkInstallable = callPackage (import ../../nix/mk-installable) { }; 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 {

View File

@@ -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,12 +99,15 @@
}; };
}; };
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
copyAllCodecs = lib.concatLines (
lib.mapAttrsToList (
name: _: "cp -r ${packageVariants."webp-squoosh-${name}"} $out/${name}"
) variants
);
in in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "all-variants"; name = "all-variants";
@@ -113,7 +120,9 @@
in in
mkInstallable { mkInstallable {
packages = packageVariants // {default = defaultPackage;}; packages = packageVariants // {
default = defaultPackage;
};
} }
); );
} }