diff --git a/flake.lock b/flake.lock index 0ec3471f5b..60df63e6f9 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "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" + } + }, "nixpkgs": { "locked": { "lastModified": 1686960236, @@ -18,8 +36,24 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "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", diff --git a/flake.nix b/flake.nix index 6f6dbabcab..caa7d9b560 100644 --- a/flake.nix +++ b/flake.nix @@ -2,54 +2,60 @@ description = "GPAC Multimedia Open Source Project"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs }@inputs: - let - pkgs = nixpkgs.legacyPackages.x86_64-linux; - buildInputs = with pkgs; [ - zlib - git - freetype - libjpeg_turbo - libpng - libmad - faad2 - libogg - libvorbis - libtheora - a52dec - ffmpeg - xorg.libX11 - xorg.libXv - xorg.xorgproto - mesa - xvidcore - openssl - alsa-lib - jack2 - pulseaudio - SDL2 - mesa-demos - ]; - nativeBuildInputs = with pkgs; [ pkg-config ]; - in - with pkgs; { - devShells.x86_64-linux.default = mkShell { - inherit buildInputs nativeBuildInputs; - }; - packages.x86_64-linux.default = with import nixpkgs { system = "x86_64-linux"; }; - stdenv.mkDerivation { - name = "gpac"; - src = self; - inherit buildInputs nativeBuildInputs; - configurePhase = '' - runHook preConfigure - ./configure --prefix=$out - runHook postConfigure - ''; - buildPhase = "make -j $NIX_BUILD_CORES"; - installPhase = "make install"; - }; + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + name = "gpac"; + src = self; + pkgs = nixpkgs.legacyPackages.${system}; + buildInputs = with pkgs; [ + zlib + freetype + libjpeg_turbo + libpng + libmad + faad2 + libogg + libvorbis + libtheora + a52dec + ffmpeg + xvidcore + openssl + alsa-lib + SDL2 + ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ + darwin.CarbonHeaders + ] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ + mesa + mesa-demos + pulseaudio + jack2 + xorg.libX11 + xorg.libXv + xorg.xorgproto + ]; + nativeBuildInputs = with pkgs; [ git pkg-config ]; + in + with pkgs; + { + packages.default = stdenv.mkDerivation { + inherit buildInputs name src nativeBuildInputs; + }; - }; + devShells.default = mkShell { + inherit buildInputs nativeBuildInputs; + }; + + meta = with nixpkgs.lib; { + homepage = "https://gpac.io"; + description = + "For Video Streaming and Next-Gen Multimedia Transcoding, Packaging and Delivery."; + platforms = platforms.all; + }; + } + ); + }