From 0d4d401b7f67766f52052b123d61988e8deadfb2 Mon Sep 17 00:00:00 2001 From: 3noch Date: Fri, 6 Jan 2017 02:09:54 -0500 Subject: [PATCH] nginx: add PageSpeed module (Linux only) --- pkgs/development/libraries/psol/default.nix | 5 ++++ pkgs/development/libraries/psol/generic.nix | 16 ++++++++++++ pkgs/servers/http/nginx/modules.nix | 29 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 ++- 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/libraries/psol/default.nix create mode 100644 pkgs/development/libraries/psol/generic.nix diff --git a/pkgs/development/libraries/psol/default.nix b/pkgs/development/libraries/psol/default.nix new file mode 100644 index 000000000000..5c78c1a288f6 --- /dev/null +++ b/pkgs/development/libraries/psol/default.nix @@ -0,0 +1,5 @@ +{ callPackage }: +callPackage ./generic.nix {} { + version = "1.11.33.4"; + sha256 = "1jq2llp0i4666rwqnx1hs4pjlpblxivvs1jkkjzlmdbsv28jzjq8"; +} diff --git a/pkgs/development/libraries/psol/generic.nix b/pkgs/development/libraries/psol/generic.nix new file mode 100644 index 000000000000..3e82bb4975dc --- /dev/null +++ b/pkgs/development/libraries/psol/generic.nix @@ -0,0 +1,16 @@ +{ fetchzip, stdenv }: +{ version, sha256 }: +{ inherit version; } // fetchzip { + inherit sha256; + name = "psol-${version}"; + url = "https://dl.google.com/dl/page-speed/psol/${version}.tar.gz"; + + meta = { + description = "PageSpeed Optimization Libraries"; + homepage = "https://developers.google.com/speed/pagespeed/psol"; + license = stdenv.lib.licenses.asl20; + # WARNING: This only works with Linux because the pre-built PSOL binary is only supplied for Linux. + # TODO: Build PSOL from source to support more platforms. + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/servers/http/nginx/modules.nix b/pkgs/servers/http/nginx/modules.nix index d19c147ce932..20ea55f82a10 100644 --- a/pkgs/servers/http/nginx/modules.nix +++ b/pkgs/servers/http/nginx/modules.nix @@ -146,4 +146,33 @@ sha256 = "0ib2jrbjwrhvmihhnzkp4w87fxssbbmmmj6lfdwpm6ni8p9g60dw"; }; }; + + pagespeed = + let + version = pkgs.psol.version; + + moduleSrc = fetchFromGitHub { + owner = "pagespeed"; + repo = "ngx_pagespeed"; + rev = "v${version}-beta"; + sha256 = "03dvzf1lgsjxcs1jjxq95n2rhgq0wy0f9ahvgascy0fak7qx4xj9"; + }; + + ngx_pagespeed = pkgs.runCommand + "ngx_pagespeed" + { + meta = { + description = "PageSpeed module for Nginx"; + homepage = "https://developers.google.com/speed/pagespeed/module/"; + license = pkgs.stdenv.lib.licenses.asl20; + }; + } + '' + cp -r "${moduleSrc}" "$out" + chmod -R +w "$out" + ln -s "${pkgs.psol}" "$out/psol" + ''; + in { + src = ngx_pagespeed; + }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index adc434f97d7c..f05b3dab363e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8395,7 +8395,7 @@ in libpfm = callPackage ../development/libraries/libpfm { }; - libpqxx = callPackage ../development/libraries/libpqxx { + libpqxx = callPackage ../development/libraries/libpqxx { gnused = gnused_422; }; @@ -14589,6 +14589,8 @@ in autoAwaySupport = config.profanity.autoAwaySupport or true; }; + psol = callPackage ../development/libraries/psol/default.nix { }; + pstree = callPackage ../applications/misc/pstree { }; pulseview = callPackage ../applications/science/electronics/pulseview { };