mirror of
https://github.com/ilyakooo0/phantomjs-nix.git
synced 2024-10-05 16:27:41 +03:00
Initial commit
This commit is contained in:
commit
c072f8eb43
42
flake.lock
Normal file
42
flake.lock
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1676283394,
|
||||
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1677686324,
|
||||
"narHash": "sha256-Car9Cfbe7RQio2jwaBQVnrLTqRgiNK0S/WoAKP1cd9g=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "8da88c64bf6179ccd43a0b48acf9cd277e250f0c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
31
flake.nix
Normal file
31
flake.nix
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { flake-utils, nixpkgs, ... }:
|
||||
let
|
||||
supportedSystems =
|
||||
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
||||
in flake-utils.lib.eachSystem supportedSystems (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config = {
|
||||
permittedInsecurePackages =
|
||||
[ "python-2.7.18.6" "qtwebkit-5.212.0-alpha4" ];
|
||||
};
|
||||
};
|
||||
phantomjsDrv = pkgs.libsForQt5.callPackage ./phantomjs { };
|
||||
in {
|
||||
packages = {
|
||||
phantomjs = phantomjsDrv;
|
||||
default = phantomjsDrv;
|
||||
};
|
||||
apps = rec {
|
||||
phantomjs = flake-utils.lib.mkApp { drv = phantomjsDrv; };
|
||||
default = phantomjs;
|
||||
};
|
||||
});
|
||||
}
|
95
phantomjs/default.nix
Normal file
95
phantomjs/default.nix
Normal file
@ -0,0 +1,95 @@
|
||||
{ lib, stdenv, fetchFromGitHub, fetchpatch, bison, flex, fontconfig, freetype
|
||||
, gperf, icu, openssl, libjpeg, libpng, perl, python2, ruby, sqlite, qtwebkit
|
||||
, qmake, qtbase, darwin, writeScriptBin, cups, makeWrapper, cmake }:
|
||||
|
||||
let
|
||||
fakeClang = writeScriptBin "clang" ''
|
||||
#!${stdenv.shell}
|
||||
if [[ "$@" == *.c ]]; then
|
||||
exec "${stdenv.cc}/bin/clang" "$@"
|
||||
else
|
||||
exec "${stdenv.cc}/bin/clang++" "$@"
|
||||
fi
|
||||
'';
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
pname = "phantomjs";
|
||||
version = "3.0.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ariya";
|
||||
repo = "phantomjs";
|
||||
rev = "0a0b0facb16acfbabb7804822ecaf4f4b9dce3d2";
|
||||
sha256 = "sha256-xLCqi9l6AIdFXMuwcZcKB8pZ1hmUK9KQTAm0jzZKBEQ=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake qmake makeWrapper ];
|
||||
buildInputs = [
|
||||
bison
|
||||
flex
|
||||
fontconfig
|
||||
freetype
|
||||
gperf
|
||||
icu
|
||||
openssl
|
||||
libjpeg
|
||||
libpng
|
||||
perl
|
||||
python2
|
||||
ruby
|
||||
sqlite
|
||||
qtwebkit
|
||||
qtbase
|
||||
] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
|
||||
AGL
|
||||
ApplicationServices
|
||||
AppKit
|
||||
Cocoa
|
||||
OpenGL
|
||||
darwin.libobjc
|
||||
fakeClang
|
||||
cups
|
||||
]);
|
||||
|
||||
__impureHostDeps = lib.optional stdenv.isDarwin "/usr/lib/libicucore.dylib";
|
||||
|
||||
dontWrapQtApps = true;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/doc/phantomjs
|
||||
cp -a bin $out
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
install_name_tool -change \
|
||||
${darwin.CF}/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation \
|
||||
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation \
|
||||
-change \
|
||||
${darwin.configd}/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration \
|
||||
/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration \
|
||||
$out/bin/phantomjs
|
||||
'' + ''
|
||||
wrapProgram $out/bin/phantomjs \
|
||||
--set QT_QPA_PLATFORM offscreen \
|
||||
--prefix PATH : ${lib.makeBinPath [ qtbase ]}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Headless WebKit with JavaScript API";
|
||||
longDescription = ''
|
||||
PhantomJS2 is a headless WebKit with JavaScript API.
|
||||
It has fast and native support for various web standards:
|
||||
DOM handling, CSS selector, JSON, Canvas, and SVG.
|
||||
|
||||
PhantomJS is an optimal solution for:
|
||||
- Headless Website Testing
|
||||
- Screen Capture
|
||||
- Page Automation
|
||||
- Network Monitoring
|
||||
'';
|
||||
|
||||
homepage = "https://phantomjs.org/";
|
||||
license = licenses.bsd3;
|
||||
|
||||
maintainers = [ maintainers.aflatter ];
|
||||
platforms = platforms.darwin ++ platforms.linux;
|
||||
};
|
||||
}
|
13
phantomjs/system-qtbase.patch
Normal file
13
phantomjs/system-qtbase.patch
Normal file
@ -0,0 +1,13 @@
|
||||
--- a/build.py
|
||||
+++ b/build.py
|
||||
@@ -80,9 +80,9 @@
|
||||
def qmakePath():
|
||||
exe = "qmake"
|
||||
if platform.system() == "Windows":
|
||||
exe += ".exe"
|
||||
- return os.path.abspath("src/qt/qtbase/bin/" + exe)
|
||||
+ return os.path.abspath("@qtbase@" + exe)
|
||||
|
||||
# returns paths for 3rd party libraries (Windows only)
|
||||
def findThirdPartyDeps():
|
||||
include_dirs = []
|
Loading…
Reference in New Issue
Block a user