on master help sign in
Initial commit
commitc072f8eb43f751641863aae29dc109c724c5b9d1 authoriko <mail@iko.soy> dateWed 1 Mar 2023, 19:32 (4 years ago)
4 files changed+181
unifiedsplit
flake.lock+42 flake.nix+31 phantomjs/default.nix+95 phantomjs/system-qtbase.patch+13
flake.locknew file+42
@@ -0,0 +1,42 @@
1+{
2+ "nodes": {
3+ "flake-utils": {
4+ "locked": {
5+ "lastModified": 1676283394,
6+ "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
7+ "owner": "numtide",
8+ "repo": "flake-utils",
9+ "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
10+ "type": "github"
11+ },
12+ "original": {
13+ "owner": "numtide",
14+ "repo": "flake-utils",
15+ "type": "github"
16+ }
17+ },
18+ "nixpkgs": {
19+ "locked": {
20+ "lastModified": 1677686324,
21+ "narHash": "sha256-Car9Cfbe7RQio2jwaBQVnrLTqRgiNK0S/WoAKP1cd9g=",
22+ "owner": "NixOS",
23+ "repo": "nixpkgs",
24+ "rev": "8da88c64bf6179ccd43a0b48acf9cd277e250f0c",
25+ "type": "github"
26+ },
27+ "original": {
28+ "owner": "NixOS",
29+ "repo": "nixpkgs",
30+ "type": "github"
31+ }
32+ },
33+ "root": {
34+ "inputs": {
35+ "flake-utils": "flake-utils",
36+ "nixpkgs": "nixpkgs"
37+ }
38+ }
39+ },
40+ "root": "root",
41+ "version": 7
42+}
flake.nixnew file+31
@@ -0,0 +1,31 @@
1+{
2+ inputs = {
3+ nixpkgs.url = "github:NixOS/nixpkgs";
4+ flake-utils.url = "github:numtide/flake-utils";
5+ };
6+
7+ outputs = { flake-utils, nixpkgs, ... }:
8+ let
9+ supportedSystems =
10+ [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
11+ in flake-utils.lib.eachSystem supportedSystems (system:
12+ let
13+ pkgs = import nixpkgs {
14+ inherit system;
15+ config = {
16+ permittedInsecurePackages =
17+ [ "python-2.7.18.6" "qtwebkit-5.212.0-alpha4" ];
18+ };
19+ };
20+ phantomjsDrv = pkgs.libsForQt5.callPackage ./phantomjs { };
21+ in {
22+ packages = {
23+ phantomjs = phantomjsDrv;
24+ default = phantomjsDrv;
25+ };
26+ apps = rec {
27+ phantomjs = flake-utils.lib.mkApp { drv = phantomjsDrv; };
28+ default = phantomjs;
29+ };
30+ });
31+}
phantomjs/default.nixnew file+95
@@ -0,0 +1,95 @@
1+{ lib, stdenv, fetchFromGitHub, fetchpatch, bison, flex, fontconfig, freetype
2+, gperf, icu, openssl, libjpeg, libpng, perl, python2, ruby, sqlite, qtwebkit
3+, qmake, qtbase, darwin, writeScriptBin, cups, makeWrapper, cmake }:
4+
5+let
6+ fakeClang = writeScriptBin "clang" ''
7+ #!${stdenv.shell}
8+ if [[ "$@" == *.c ]]; then
9+ exec "${stdenv.cc}/bin/clang" "$@"
10+ else
11+ exec "${stdenv.cc}/bin/clang++" "$@"
12+ fi
13+ '';
14+
15+in stdenv.mkDerivation {
16+ pname = "phantomjs";
17+ version = "3.0.0";
18+
19+ src = fetchFromGitHub {
20+ owner = "ariya";
21+ repo = "phantomjs";
22+ rev = "0a0b0facb16acfbabb7804822ecaf4f4b9dce3d2";
23+ sha256 = "sha256-xLCqi9l6AIdFXMuwcZcKB8pZ1hmUK9KQTAm0jzZKBEQ=";
24+ };
25+
26+ nativeBuildInputs = [ cmake qmake makeWrapper ];
27+ buildInputs = [
28+ bison
29+ flex
30+ fontconfig
31+ freetype
32+ gperf
33+ icu
34+ openssl
35+ libjpeg
36+ libpng
37+ perl
38+ python2
39+ ruby
40+ sqlite
41+ qtwebkit
42+ qtbase
43+ ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
44+ AGL
45+ ApplicationServices
46+ AppKit
47+ Cocoa
48+ OpenGL
49+ darwin.libobjc
50+ fakeClang
51+ cups
52+ ]);
53+
54+ __impureHostDeps = lib.optional stdenv.isDarwin "/usr/lib/libicucore.dylib";
55+
56+ dontWrapQtApps = true;
57+
58+ installPhase = ''
59+ mkdir -p $out/share/doc/phantomjs
60+ cp -a bin $out
61+ '' + lib.optionalString stdenv.isDarwin ''
62+ install_name_tool -change \
63+ ${darwin.CF}/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation \
64+ /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation \
65+ -change \
66+ ${darwin.configd}/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration \
67+ /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration \
68+ $out/bin/phantomjs
69+ '' + ''
70+ wrapProgram $out/bin/phantomjs \
71+ --set QT_QPA_PLATFORM offscreen \
72+ --prefix PATH : ${lib.makeBinPath [ qtbase ]}
73+ '';
74+
75+ meta = with lib; {
76+ description = "Headless WebKit with JavaScript API";
77+ longDescription = ''
78+ PhantomJS2 is a headless WebKit with JavaScript API.
79+ It has fast and native support for various web standards:
80+ DOM handling, CSS selector, JSON, Canvas, and SVG.
81+
82+ PhantomJS is an optimal solution for:
83+ - Headless Website Testing
84+ - Screen Capture
85+ - Page Automation
86+ - Network Monitoring
87+ '';
88+
89+ homepage = "https://phantomjs.org/";
90+ license = licenses.bsd3;
91+
92+ maintainers = [ maintainers.aflatter ];
93+ platforms = platforms.darwin ++ platforms.linux;
94+ };
95+}
phantomjs/system-qtbase.patchnew file+13
@@ -0,0 +1,13 @@
1+--- a/build.py
2++++ b/build.py
3+@@ -80,9 +80,9 @@
4+ def qmakePath():
5+ exe = "qmake"
6+ if platform.system() == "Windows":
7+ exe += ".exe"
8+- return os.path.abspath("src/qt/qtbase/bin/" + exe)
9++ return os.path.abspath("@qtbase@" + exe)
10+
11+ # returns paths for 3rd party libraries (Windows only)
12+ def findThirdPartyDeps():
13+ include_dirs = []