]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - pkgs/webapps/mediagoblin/default.nix
Use new withPlugin system
[perso/Immae/Config/Nix.git] / pkgs / webapps / mediagoblin / default.nix
index e1ca898640d72de885a92971a1cc0aa7a606355f..d348ce1fd3f9bf8849506052efc73e910b9a6e37 100644 (file)
@@ -1,7 +1,16 @@
-{ makeWrapper, stdenv, writeScript, fetchurl, buildBowerComponents, mylibs, which, python36, gst_all_1, automake, autoconf, nodejs, nodePackages }:
+{ makeWrapper, stdenv, writeScript, fetchurl, buildBowerComponents, mylibs, which, python36, gst_all_1, automake, autoconf, nodejs, nodePackages, lib, callPackage }:
 let
   overridePython = let
     packageOverrides = self: super: {
+      pybcrypt = super.buildPythonPackage rec {
+        pname = "pybcrypt";
+        version = "0.4";
+
+        src = self.fetchPypi {
+          inherit pname version;
+          sha256 = "5fa13bce551468350d66c4883694850570f3da28d6866bb638ba44fe5eabda78";
+        };
+      };
       celery = super.celery.overridePythonAttrs(old: rec {
         version = "3.1.26.post2";
         src = self.fetchPypi {
@@ -19,6 +28,8 @@ let
           inherit (old) pname;
           sha256 = "02wxsc6bhqvzh8j6w758kvgqbnj14l796mvmrcms8fgfamd2lak9";
         };
+        doCheck = false;
+        doInstallCheck = false;
       });
       amqp = super.amqp.overridePythonAttrs(old: rec {
         version = "1.4.9";
@@ -45,6 +56,7 @@ let
           inherit (old) pname;
           sha256 = "8b0ec71af9291191ba83a91c03d157b19ab3e7119e27da97932a4773a3f664a9";
         };
+        doCheck = false;
       });
       tempita_5_3_dev = super.buildPythonPackage (mylibs.fetchedGithub ./tempita.json // rec {
         buildInputs = with self; [ nose ];
@@ -101,16 +113,22 @@ let
     generated = ./bower-packages.nix;
     src = (mylibs.fetchedGit ./mediagoblin.json).src;
   };
-  withPlugins = plugins: package.overrideAttrs(old: {
-    name = "${old.name}-with-plugins";
-    postBuild = old.postBuild + (
-      builtins.concatStringsSep "\n" (
-        map (value: "ln -s ${value} mediagoblin/plugins/${value.pluginName}") plugins
-        )
-      );
-    passthru.plugins = plugins;
-    passthru.withPlugins = morePlugins: old.withPlugins (morePlugins ++ plugins);
-  });
+  pluginNames = [ "basicsearch" ];
+  allPlugins = lib.attrsets.genAttrs pluginNames
+    (name: callPackage (./plugins + "/${name}") {});
+  toPassthru = pkg: {
+    inherit allPlugins;
+    withPlugins = withPlugins pkg;
+  };
+  withPlugins = pkg: toPlugins:
+    let
+      plugins = toPlugins allPlugins;
+      toBuildPlugin = n: "ln -s ${n} mediagoblin/plugins/${n.pluginName}";
+      newMediagoblin = pkg.overrideAttrs(old: {
+        postBuild = old.postBuild + "\n" + builtins.concatStringsSep "\n" (map toBuildPlugin plugins);
+        passthru = toPassthru newMediagoblin;
+      });
+    in newMediagoblin;
   package = stdenv.mkDerivation (mylibs.fetchedGit ./mediagoblin.json // rec {
     preConfigure = ''
       # ./bootstrap.sh
@@ -159,9 +177,6 @@ let
       '';
     buildInputs = [ makeWrapper automake autoconf which nodePackages.bower nodejs python ];
     propagatedBuildInputs = with gst_all_1; [ python gst-libav gst-plugins-good gst-plugins-bad gst-plugins-ugly gstreamer ];
-    passthru = {
-      plugins = [];
-      inherit withPlugins;
-    };
+    passthru = toPassthru package;
   });
 in package