Work on all systems

This commit is contained in:
Surma
2024-08-07 10:34:05 +01:00
parent 95a16e3919
commit 2bd1eeceb8
2 changed files with 108 additions and 72 deletions

View File

@@ -1,6 +1,24 @@
{ {
"nodes": { "nodes": {
"mozjpeg": { "flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"mozjpeg-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1499684294, "lastModified": 1499684294,
@@ -35,9 +53,25 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"mozjpeg": "mozjpeg", "flake-utils": "flake-utils",
"mozjpeg-src": "mozjpeg-src",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View File

@@ -1,9 +1,8 @@
{ {
inputs = { inputs = {
nixpkgs = { nixpkgs.url = "github:nixos/nixpkgs/24.05";
url = "github:nixos/nixpkgs/24.05"; flake-utils.url = "github:numtide/flake-utils";
}; mozjpeg-src = {
mozjpeg = {
url = "github:mozilla/mozjpeg/v3.3.1"; url = "github:mozilla/mozjpeg/v3.3.1";
flake = false; flake = false;
}; };
@@ -12,23 +11,25 @@
{ {
self, self,
nixpkgs, nixpkgs,
mozjpeg, flake-utils,
mozjpeg-src,
}: }:
flake-utils.lib.eachDefaultSystem (
system:
let let
system = "aarch64-darwin"; pkgs = nixpkgs.legacyPackages.${system};
pkgs = import nixpkgs { inherit system; };
in in
with pkgs; with pkgs;
rec { {
packages.${system} = { packages = rec {
default = stdenv.mkDerivation { default = stdenv.mkDerivation {
name = "mozjpeg-squoosh"; name = "mozjpeg-squoosh";
src = ./.; src = ./.;
nativeBuildInputs = [ nativeBuildInputs = [
emscripten emscripten
packages.${system}.mozjpeg mozjpeg
]; ];
MOZJPEG = packages.${system}.mozjpeg; MOZJPEG = mozjpeg;
dontConfigure = true; dontConfigure = true;
buildPhase = '' buildPhase = ''
export HOME=$TMPDIR export HOME=$TMPDIR
@@ -41,7 +42,7 @@
}; };
mozjpeg = stdenv.mkDerivation { mozjpeg = stdenv.mkDerivation {
name = "mozjpeg"; name = "mozjpeg";
src = mozjpeg; src = mozjpeg-src;
nativeBuildInputs = [ nativeBuildInputs = [
autoconf autoconf
automake automake
@@ -75,7 +76,7 @@
dontFixup = true; dontFixup = true;
}; };
}; };
devShells.${system}.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
packages = [ packages = [
autoconf autoconf
automake automake
@@ -84,8 +85,9 @@
pkg-config pkg-config
]; ];
shellHook = '' shellHook = ''
echo "Path to MozJPEG: ${mozjpeg}" echo "Path to MozJPEG: ${mozjpeg-src}"
''; '';
}; };
}; }
);
} }