]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Purify wallabag's website
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 24 Jan 2019 08:56:31 +0000 (09:56 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 24 Jan 2019 08:56:31 +0000 (09:56 +0100)
virtual/modules/websites/commons/composer-env.nix
virtual/modules/websites/tools/tools/wallabag.nix
virtual/modules/websites/tools/tools/wallabag_ldap.patch

index 051ac6e9e2d7d33db043831d31aed71cd6b142d7..416a61cab39567d15e433680325742a7409cd4b2 100644 (file)
@@ -63,6 +63,7 @@ let
     , noDev ? false
     , unpackPhase ? "true"
     , buildPhase ? "true"
+    , doRemoveVendor ? true
     , ...}@args:
 
     let
@@ -197,9 +198,10 @@ let
 
         export HOME=$TMPDIR
 
+        ${if doRemoveVendor then ''
         # Remove the provided vendor folder if it exists
         rm -Rf vendor
-
+        '' else ""}
         # If there is no composer.lock file, compose a dummy file.
         # Otherwise, composer attempts to download the package.json file from
         # the registry which we do not want.
index 03291dc47c37500b4e5b17d4dce6b7611a2daff8..d742c5d3ad313538247567f3698e505d65a6cb4a 100644 (file)
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, writeText, env, phpPackages, php, which }:
+{ stdenv, fetchurl, writeText, env, composerEnv, phpPackages, php, which }:
 let
   wallabag = rec {
     varDir = "/var/lib/wallabag";
@@ -56,8 +56,31 @@ let
           ldap_name_attribute: cn
           ldap_enabled_attribute: null
       '';
-    webappDir = stdenv.mkDerivation rec {
-      __noChroot = true;
+    webappDir = composerEnv.buildPackage rec {
+      packages = {
+        "fr3d/ldap-bundle" = {
+          targetDir = "";
+          src = composerEnv.buildZipPackage {
+            name = "fr3d-ldap-bundle-5a8927c11af45fa06331b97221c6da1a4a237475";
+            src = fetchurl {
+              url = https://api.github.com/repos/Maks3w/FR3DLdapBundle/zipball/5a8927c11af45fa06331b97221c6da1a4a237475;
+              sha256 = "168zkd82j200wd6h0a3lq81g5s2pifg889rv27q2g429nppsbfxc";
+            };
+          };
+        };
+        "zendframework/zend-ldap" = {
+          targetDir = "";
+          src = composerEnv.buildZipPackage {
+            name = "zendframework-zend-ldap-b63c7884a08d3a6bda60ebcf7d6238cf8ad89f49";
+            src = fetchurl {
+              url = https://api.github.com/repos/zendframework/zend-ldap/zipball/b63c7884a08d3a6bda60ebcf7d6238cf8ad89f49;
+              sha256 = "0mn4yqnb5prqhrbbybmw1i2rx7xf4s4wagbdq9qi55fa0vk3jgw9";
+            };
+          };
+        };
+      };
+      noDev = true;
+      doRemoveVendor = false;
       # Beware when upgrading, I probably messed up with the migrations table
       # (due to a psql bug in wallabag)
       version = "2.3.6";
@@ -66,21 +89,22 @@ let
         url = "https://static.wallabag.org/releases/wallabag-release-${version}.tar.gz";
         sha256 = "0m0dy3r94ks5pfxyb9vbgrsm0vrwdl3jd5wqwg4f5vd107lq90q1";
       };
+      unpackPhase = ''
+        unpackFile "$src"
+        sourceRoot=${version}
+        src=$PWD/${version}
+        '';
       patches = [ ./wallabag_ldap.patch ];
-      dontBuild = "true";
-      installPhase = ''
-        cp -a . $out
-        cd $out
-        export SYMFONY_ENV=prod
-        php -d memory_limit=-1 ${phpPackages.composer}/libexec/composer/composer.phar require --update-no-dev -o --prefer-dist fr3d/ldap-bundle
-        rm -rf web/assets var/cache app/config/parameters.yml data
-        mv var var_old
+      preInstall = ''
+        export SYMFONY_ENV="prod"
+      '';
+      postInstall = ''
+        rm -rf web/assets var/{cache,logs,sessions} app/config/parameters.yml data
         ln -sf ${parameters} app/config/parameters.yml
-        ln -sf ../../../../../${varDir}/var var
+        ln -sf ../../../../../../${varDir}/var/{cache,logs,sessions} var
         ln -sf ../../../../../${varDir}/data data
         ln -sf ../../../../../../${varDir}/assets web/assets
       '';
-      buildInputs = [ php phpPackages.composer ];
     };
     activationScript = ''
       install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
index 1b93b57307bbcc8a53039decec75e5476a74f9c1..9caf7dac0c5543598b9aa1ead0bd982a76307b8b 100644 (file)
@@ -1,14 +1,8 @@
-commit 4cd6e7f3bbcff7e2a1c5a39917176d28fa02911f
-Author: Ismaël Bouya <ismael.bouya@normalesup.org>
-Date:   Sat Jun 16 11:40:00 2018 +0200
-
-    Add ldap
-
 diff --git a/.travis.yml b/.travis.yml
-index 57b3aa53..3b7638eb 100644
+index 04cea258..56b1f576 100644
 --- a/.travis.yml
 +++ b/.travis.yml
-@@ -54,6 +54,7 @@ branches:
+@@ -58,6 +58,7 @@ install:
  
  before_script:
      - PHP=$TRAVIS_PHP_VERSION
@@ -120,7 +114,7 @@ index 6b0cb8e8..cfd41b69 100644
 +    # optional (default sets user as enabled unconditionally)
 +    ldap_enabled_attribute: ~
 diff --git a/app/config/security.yml b/app/config/security.yml
-index 796dc361..59f48626 100644
+index 02afc9ea..48fbb553 100644
 --- a/app/config/security.yml
 +++ b/app/config/security.yml
 @@ -6,6 +6,7 @@ security:
@@ -140,24 +134,191 @@ index 796dc361..59f48626 100644
              pattern: ^/
              form_login:
 diff --git a/composer.json b/composer.json
-index dca274ed..f115d229 100644
+index 68cfad05..32a3d1a4 100644
 --- a/composer.json
 +++ b/composer.json
-@@ -87,6 +87,9 @@
+@@ -85,7 +85,11 @@
+         "friendsofsymfony/jsrouting-bundle": "^1.6.3",
+         "bdunogier/guzzle-site-authenticator": "^1.0.0",
          "defuse/php-encryption": "^2.1",
-         "html2text/html2text": "^4.1"
-     },
+-        "html2text/html2text": "^4.1"
++        "html2text/html2text": "^4.1",
++        "fr3d/ldap-bundle": "^3.0"
++    },
 +    "suggest": {
 +      "fr3d/ldap-bundle": "If you want to authenticate via LDAP"
-+    },
+     },
      "require-dev": {
          "doctrine/doctrine-fixtures-bundle": "~2.2",
-         "doctrine/data-fixtures": "~1.1",
+diff --git a/composer.lock b/composer.lock
+index 251ee081..37795e0b 100644
+--- a/composer.lock
++++ b/composer.lock
+@@ -4,7 +4,7 @@
+         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+         "This file is @generated automatically"
+     ],
+-    "content-hash": "d2a0bd8408dccdeb7a7455996519829b",
++    "content-hash": "4699d166d03a8e5f70d802d0bc3e6a20",
+     "packages": [
+         {
+             "name": "bdunogier/guzzle-site-authenticator",
+@@ -1346,6 +1346,65 @@
+             ],
+             "time": "2018-12-14T19:44:53+00:00"
+         },
++        {
++            "name": "fr3d/ldap-bundle",
++            "version": "v3.0.0",
++            "source": {
++                "type": "git",
++                "url": "https://github.com/Maks3w/FR3DLdapBundle.git",
++                "reference": "5a8927c11af45fa06331b97221c6da1a4a237475"
++            },
++            "dist": {
++                "type": "zip",
++                "url": "https://api.github.com/repos/Maks3w/FR3DLdapBundle/zipball/5a8927c11af45fa06331b97221c6da1a4a237475",
++                "reference": "5a8927c11af45fa06331b97221c6da1a4a237475",
++                "shasum": ""
++            },
++            "require": {
++                "php": ">=5.5",
++                "psr/log": "~1.0",
++                "symfony/config": "2.3 - 3",
++                "symfony/dependency-injection": "2.3 - 3",
++                "symfony/polyfill-php56": "^1.1",
++                "symfony/security": "2.3 - 3",
++                "symfony/security-bundle": "2.3 - 3",
++                "zendframework/zend-ldap": "2.5 - 3"
++            },
++            "require-dev": {
++                "fabpot/php-cs-fixer": "1.11.*",
++                "fr3d/psr3-message-assertions": "0.1.*",
++                "friendsofsymfony/user-bundle": "~1.3",
++                "maks3w/phpunit-methods-trait": "^4.6",
++                "phpunit/phpunit": "^4.6",
++                "symfony/validator": "2.3 - 3"
++            },
++            "suggest": {
++                "friendsofsymfony/user-bundle": "Integrate authentication and management for DB users, useful for unmanned LDAP servers",
++                "symfony/validator": "Allow pre-validate for existing users before register new ones"
++            },
++            "type": "symfony-bundle",
++            "autoload": {
++                "psr-4": {
++                    "FR3D\\LdapBundle\\": ""
++                }
++            },
++            "notification-url": "https://packagist.org/downloads/",
++            "license": [
++                "MIT"
++            ],
++            "authors": [
++                {
++                    "name": "Maks3w"
++                }
++            ],
++            "description": "This package provide users and authentication services based on LDAP directories for Symfony2 framework",
++            "homepage": "https://github.com/Maks3w/FR3DLdapBundle",
++            "keywords": [
++                "Authentication",
++                "ldap"
++            ],
++            "time": "2016-02-12T17:45:14+00:00"
++        },
+         {
+             "name": "friendsofsymfony/jsrouting-bundle",
+             "version": "1.6.3",
+@@ -7027,6 +7086,59 @@
+                 "zf2"
+             ],
+             "time": "2018-04-25T15:33:34+00:00"
++        },
++        {
++            "name": "zendframework/zend-ldap",
++            "version": "2.10.0",
++            "source": {
++                "type": "git",
++                "url": "https://github.com/zendframework/zend-ldap.git",
++                "reference": "b63c7884a08d3a6bda60ebcf7d6238cf8ad89f49"
++            },
++            "dist": {
++                "type": "zip",
++                "url": "https://api.github.com/repos/zendframework/zend-ldap/zipball/b63c7884a08d3a6bda60ebcf7d6238cf8ad89f49",
++                "reference": "b63c7884a08d3a6bda60ebcf7d6238cf8ad89f49",
++                "shasum": ""
++            },
++            "require": {
++                "ext-ldap": "*",
++                "php": "^5.6 || ^7.0"
++            },
++            "require-dev": {
++                "php-mock/php-mock-phpunit": "^1.1.2 || ^2.1.1",
++                "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2",
++                "zendframework/zend-coding-standard": "~1.0.0",
++                "zendframework/zend-config": "^2.5",
++                "zendframework/zend-eventmanager": "^2.6.3 || ^3.0.1",
++                "zendframework/zend-stdlib": "^2.7 || ^3.0"
++            },
++            "suggest": {
++                "zendframework/zend-eventmanager": "Zend\\EventManager component"
++            },
++            "type": "library",
++            "extra": {
++                "branch-alias": {
++                    "dev-master": "2.10.x-dev",
++                    "dev-develop": "2.11.x-dev"
++                }
++            },
++            "autoload": {
++                "psr-4": {
++                    "Zend\\Ldap\\": "src/"
++                }
++            },
++            "notification-url": "https://packagist.org/downloads/",
++            "license": [
++                "BSD-3-Clause"
++            ],
++            "description": "Provides support for LDAP operations including but not limited to binding, searching and modifying entries in an LDAP directory",
++            "keywords": [
++                "ZendFramework",
++                "ldap",
++                "zf"
++            ],
++            "time": "2018-07-05T05:05:12+00:00"
+         }
+     ],
+     "packages-dev": [
+@@ -7561,12 +7673,12 @@
+             "source": {
+                 "type": "git",
+                 "url": "https://github.com/symfony/phpunit-bridge.git",
+-                "reference": "5dab0d4b2ac99ab22b447b615fdfdc10ec4af3d5"
++                "reference": "d61ec438634e0f234c6bda1c6ee97016bbb0e7a1"
+             },
+             "dist": {
+                 "type": "zip",
+-                "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/5dab0d4b2ac99ab22b447b615fdfdc10ec4af3d5",
+-                "reference": "5dab0d4b2ac99ab22b447b615fdfdc10ec4af3d5",
++                "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/d61ec438634e0f234c6bda1c6ee97016bbb0e7a1",
++                "reference": "d61ec438634e0f234c6bda1c6ee97016bbb0e7a1",
+                 "shasum": ""
+             },
+             "require": {
+@@ -7619,7 +7731,7 @@
+             ],
+             "description": "Symfony PHPUnit Bridge",
+             "homepage": "https://symfony.com",
+-            "time": "2019-01-01T13:45:19+00:00"
++            "time": "2019-01-16T13:27:11+00:00"
+         },
+         {
+             "name": "symfony/polyfill-php72",
 diff --git a/scripts/install.sh b/scripts/install.sh
-index 62a46f4f..5ea3933c 100644
+index 8b7ea03f..3a4a33ab 100755
 --- a/scripts/install.sh
 +++ b/scripts/install.sh
-@@ -12,5 +12,8 @@ ENV=$1
+@@ -26,5 +26,8 @@ ENV=$1
  TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
  
  git checkout $TAG
@@ -167,10 +328,10 @@ index 62a46f4f..5ea3933c 100644
  SYMFONY_ENV=$ENV $COMPOSER_COMMAND install --no-dev -o --prefer-dist
  php bin/console wallabag:install --env=$ENV
 diff --git a/scripts/update.sh b/scripts/update.sh
-index d0598135..753ccbc3 100644
+index c62d104a..6259a431 100755
 --- a/scripts/update.sh
 +++ b/scripts/update.sh
-@@ -18,6 +18,9 @@ git fetch origin
+@@ -32,6 +32,9 @@ git fetch origin
  git fetch --tags
  TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
  git checkout $TAG --force