aboutsummaryrefslogtreecommitdiff
path: root/pkgs
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-11 16:55:50 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-11 17:06:20 +0200
commit7667c367033b15582cf383da62446f78e66a59ef (patch)
tree5349427aa43070dd603802f68963b30c1c544232 /pkgs
parentc890321db12036be69ebbece202984874b1e5a57 (diff)
downloadNix-7667c367033b15582cf383da62446f78e66a59ef.tar.gz
Nix-7667c367033b15582cf383da62446f78e66a59ef.tar.zst
Nix-7667c367033b15582cf383da62446f78e66a59ef.zip
Move spip and chloe website to pkgs
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/private/default.nix6
-rw-r--r--pkgs/private/webapps/chloe/chloe.json14
-rw-r--r--pkgs/private/webapps/chloe/default.nix19
-rw-r--r--pkgs/private/webapps/default.nix3
-rw-r--r--pkgs/webapps/default.nix1
-rw-r--r--pkgs/webapps/spip/default.nix32
-rw-r--r--pkgs/webapps/spip/spip_ldap_patch.patch60
-rw-r--r--pkgs/webapps/spip/spip_mes_options.php18
8 files changed, 151 insertions, 2 deletions
diff --git a/pkgs/private/default.nix b/pkgs/private/default.nix
index 951a23f..60fabad 100644
--- a/pkgs/private/default.nix
+++ b/pkgs/private/default.nix
@@ -4,5 +4,9 @@ let
4 mylibs = import ../../libs.nix { inherit pkgs; }; 4 mylibs = import ../../libs.nix { inherit pkgs; };
5in 5in
6rec { 6rec {
7 webapps = callPackage ./webapps { inherit mylibs; inherit (pkgs) composerEnv; }; 7 webapps = callPackage ./webapps {
8 inherit mylibs;
9 inherit (pkgs) composerEnv;
10 inherit (pkgs.webapps) spip;
11 };
8} 12}
diff --git a/pkgs/private/webapps/chloe/chloe.json b/pkgs/private/webapps/chloe/chloe.json
new file mode 100644
index 0000000..686d751
--- /dev/null
+++ b/pkgs/private/webapps/chloe/chloe.json
@@ -0,0 +1,14 @@
1{
2 "tag": "96fc4eb-master",
3 "meta": {
4 "name": "chloe",
5 "url": "gitolite@git.immae.eu:perso/Immae/Sites/Chloe",
6 "branch": "master"
7 },
8 "git": {
9 "url": "gitolite@git.immae.eu:perso/Immae/Sites/Chloe",
10 "rev": "96fc4eb0099a29b0f9a58fb4eaec4bf14ac65f0a",
11 "sha256": "0mf15j6z86j2smm2k360cmm5djhcjbs9949pznwi57kw97vkm1s3",
12 "fetchSubmodules": true
13 }
14}
diff --git a/pkgs/private/webapps/chloe/default.nix b/pkgs/private/webapps/chloe/default.nix
new file mode 100644
index 0000000..f148d4b
--- /dev/null
+++ b/pkgs/private/webapps/chloe/default.nix
@@ -0,0 +1,19 @@
1{ environment ? "prod"
2, varDir ? "/var/lib/chloe_${environment}"
3, spip, stdenv, mylibs, sassc }:
4let
5 siteDir = stdenv.mkDerivation (mylibs.fetchedGitPrivate ./chloe.json // rec {
6 buildPhase = ''
7 make
8 '';
9 installPhase = ''
10 cp -a . $out
11 '';
12 buildInputs = [ sassc ];
13 });
14in
15spip.override {
16 ldap = true;
17 siteName = "chloe";
18 inherit environment siteDir;
19}
diff --git a/pkgs/private/webapps/default.nix b/pkgs/private/webapps/default.nix
index 46ad31c..14fd544 100644
--- a/pkgs/private/webapps/default.nix
+++ b/pkgs/private/webapps/default.nix
@@ -1,6 +1,7 @@
1{ callPackage, mylibs, composerEnv, lib }: 1{ callPackage, mylibs, composerEnv, lib, spip }:
2rec { 2rec {
3 aten = callPackage ./aten { inherit composerEnv mylibs; }; 3 aten = callPackage ./aten { inherit composerEnv mylibs; };
4 chloe = callPackage ./chloe { inherit mylibs spip; };
4 connexionswing = callPackage ./connexionswing { inherit composerEnv mylibs;}; 5 connexionswing = callPackage ./connexionswing { inherit composerEnv mylibs;};
5 ludivinecassal = callPackage ./ludivinecassal { inherit composerEnv mylibs; }; 6 ludivinecassal = callPackage ./ludivinecassal { inherit composerEnv mylibs; };
6 piedsjaloux = callPackage ./piedsjaloux { inherit composerEnv mylibs; }; 7 piedsjaloux = callPackage ./piedsjaloux { inherit composerEnv mylibs; };
diff --git a/pkgs/webapps/default.nix b/pkgs/webapps/default.nix
index 0ef6736..229609f 100644
--- a/pkgs/webapps/default.nix
+++ b/pkgs/webapps/default.nix
@@ -86,6 +86,7 @@ rec {
86 lib.attrsets.genAttrs names 86 lib.attrsets.genAttrs names
87 (name: callPackage (./roundcubemail/plugins + "/${name}") { buildPlugin = roundcubemail.buildPlugin; }); 87 (name: callPackage (./roundcubemail/plugins + "/${name}") { buildPlugin = roundcubemail.buildPlugin; });
88 88
89 spip = callPackage ./spip {};
89 taskwarrior-web = callPackage ./taskwarrior-web { inherit mylibs; }; 90 taskwarrior-web = callPackage ./taskwarrior-web { inherit mylibs; };
90 91
91 ttrss = callPackage ./ttrss { inherit mylibs; }; 92 ttrss = callPackage ./ttrss { inherit mylibs; };
diff --git a/pkgs/webapps/spip/default.nix b/pkgs/webapps/spip/default.nix
new file mode 100644
index 0000000..8099f53
--- /dev/null
+++ b/pkgs/webapps/spip/default.nix
@@ -0,0 +1,32 @@
1{ siteName ? "spip"
2, siteDir ? runCommand "empty" { preferLocalBuild = true; } "mkdir -p $out"
3, environment ? "prod"
4, ldap ? false
5, varDir ? "/var/lib/${siteName}_${environment}"
6, lib, fetchzip, runCommand, stdenv }:
7let
8 app = stdenv.mkDerivation rec {
9 name = "${siteName}-${environment}-spip-${version}";
10 version = "3.2.3";
11 src = fetchzip {
12 url = "https://files.spip.net/spip/archives/SPIP-v${version}.zip";
13 sha256 = "1r1mjvsnrp6mvkgjakvi3x4ms8m8k5mp93micbbg8r99fj7qlfkq";
14 };
15 paches = lib.optionals ldap [ ./spip_ldap_patch.patch ];
16 buildPhase = ''
17 rm -rf IMG local tmp config/remove.txt
18 ln -sf ${./spip_mes_options.php} config/mes_options.php
19 echo "Require all denied" > "config/.htaccess"
20 ln -sf ${varDir}/{IMG,local} .
21 '';
22 installPhase = ''
23 cp -a . $out
24 cp -a ${siteDir}/* $out
25 '';
26 passthru = {
27 inherit siteName siteDir environment varDir;
28 webRoot = app;
29 spipConfig = ./spip_mes_options.php;
30 };
31 };
32in app
diff --git a/pkgs/webapps/spip/spip_ldap_patch.patch b/pkgs/webapps/spip/spip_ldap_patch.patch
new file mode 100644
index 0000000..653c909
--- /dev/null
+++ b/pkgs/webapps/spip/spip_ldap_patch.patch
@@ -0,0 +1,60 @@
1--- old/ecrire/auth/ldap.php 2017-06-08 21:58:17.000000000 +0200
2+++ new/ecrire/auth/ldap.php 2017-06-10 02:54:02.687954143 +0200
3@@ -171,24 +171,41 @@
4 $desc = isset($ldap['attributes']) && $ldap['attributes'] ? $ldap['attributes'] : $GLOBALS['ldap_attributes'] ;
5
6 $logins = is_array($desc['login']) ? $desc['login'] : array($desc['login']);
7+ if (isset($GLOBALS['ldap_search'])) {
8+ $search_query = str_replace("%user%", $login_search, $GLOBALS['ldap_search']);
9+ $result = @ldap_search($ldap_link, $ldap_base, $search_query, array("dn"));
10+ $info = @ldap_get_entries($ldap_link, $result);
11+ // Ne pas accepter les resultats si plus d'une entree
12+ // (on veut un attribut unique)
13
14- // Tenter une recherche pour essayer de retrouver le DN
15- foreach ($logins as $att) {
16- $result = @ldap_search($ldap_link, $ldap_base, "$att=$login_search", array("dn"));
17- $info = @ldap_get_entries($ldap_link, $result);
18- // Ne pas accepter les resultats si plus d'une entree
19- // (on veut un attribut unique)
20+ if (is_array($info) and $info['count'] == 1) {
21+ $dn = $info[0]['dn'];
22+ if (!$checkpass) {
23+ return $dn;
24+ }
25+ if (@ldap_bind($ldap_link, $dn, $pass)) {
26+ return $dn;
27+ }
28+ }
29+ } else {
30+ // Tenter une recherche pour essayer de retrouver le DN
31+ foreach ($logins as $att) {
32+ $result = @ldap_search($ldap_link, $ldap_base, "$att=$login_search", array("dn"));
33+ $info = @ldap_get_entries($ldap_link, $result);
34+ // Ne pas accepter les resultats si plus d'une entree
35+ // (on veut un attribut unique)
36
37- if (is_array($info) and $info['count'] == 1) {
38- $dn = $info[0]['dn'];
39- if (!$checkpass) {
40- return $dn;
41- }
42- if (@ldap_bind($ldap_link, $dn, $pass)) {
43- return $dn;
44- }
45- }
46- }
47+ if (is_array($info) and $info['count'] == 1) {
48+ $dn = $info[0]['dn'];
49+ if (!$checkpass) {
50+ return $dn;
51+ }
52+ if (@ldap_bind($ldap_link, $dn, $pass)) {
53+ return $dn;
54+ }
55+ }
56+ }
57+ }
58
59 if ($checkpass and !isset($dn)) {
60 // Si echec, essayer de deviner le DN
diff --git a/pkgs/webapps/spip/spip_mes_options.php b/pkgs/webapps/spip/spip_mes_options.php
new file mode 100644
index 0000000..8db8389
--- /dev/null
+++ b/pkgs/webapps/spip/spip_mes_options.php
@@ -0,0 +1,18 @@
1<?php // /!\ Important: There must be no blank space before &lt;?php or after ?&gt;
2// This file was inspired from the spip contrib website
3// http://www.spip.net/fr_article3811.html
4
5$config_dir = getenv('SPIP_CONFIG_DIR') . '/';
6$var_dir = getenv('SPIP_VAR_DIR') . '/';
7
8$cookie_prefix = str_replace('.', '_', getenv("SPIP_SITE"));
9$table_prefix = 'spip';
10
11spip_initialisation(
12 $config_dir,
13 _DIR_RACINE . _NOM_PERMANENTS_ACCESSIBLES,
14 $var_dir . _NOM_TEMPORAIRES_INACCESSIBLES,
15 _DIR_RACINE . _NOM_TEMPORAIRES_ACCESSIBLES
16);
17
18?>