]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - flakes/etherpad-lite/default.nix
Squash changes containing private information
[perso/Immae/Config/Nix.git] / flakes / etherpad-lite / default.nix
similarity index 77%
rename from pkgs/webapps/etherpad-lite/default.nix
rename to flakes/etherpad-lite/default.nix
index 4327384840be37ad7dc8ec812c368bcf2a5e9e27..1dd5aa4302293ce768e9bc7fd1de9f8f5f5f829b 100644 (file)
@@ -1,7 +1,6 @@
 { varDir ? "/var/lib/etherpad-lite" # if you override this change the StateDirectory in service file too!
-, stdenv, callPackage, mylibs, lib }:
+, nodeEnv, stdenv, callPackage, src, lib, nodejs }:
 let
-  nodeEnv = callPackage mylibs.nodeEnv {};
   moduleNames = [
     "ep_aa_file_menu_toolbar" "ep_adminpads" "ep_align" "ep_bookmark"
     "ep_clear_formatting" "ep_colors" "ep_comments_page"
@@ -14,9 +13,9 @@ let
   ];
   # nix files are built using node2nix -i node-packages.json
   allModules = lib.attrsets.genAttrs moduleNames
-    (name: (callPackage (./modules + "/${name}/node-packages.nix") { inherit nodeEnv; }).${name});
-  toPassthru = pkg: {
-    inherit varDir allModules;
+    (name: (callPackage (./modules + "/${name}/node-packages.nix") { nodeEnv = callPackage nodeEnv {}; }).${name});
+  toPassthru = pkg: moduleNames: {
+    inherit varDir allModules nodejs moduleNames;
     withModules = withModules pkg;
   };
   withModules = pkg: toModules:
@@ -29,16 +28,20 @@ let
           ln -s ${varDir}/ep_initialized/${n.packageName} $out/node_modules/${n.packageName}/.ep_initialized
         fi
       '';
+      modulesNames = map (n: n.packageName) modules;
       newEtherpad = pkg.overrideAttrs(old: {
         installPhase = old.installPhase + "\n" + builtins.concatStringsSep "\n" (map toInstallModule modules);
-        passthru = toPassthru newEtherpad;
+        passthru = toPassthru newEtherpad moduleNames;
       });
     in newEtherpad;
   # built using node2nix -l package-lock.json
   # and changing "./." to "src"
   node-environment = (callPackage ./node-packages.nix {
-    inherit nodeEnv;
-    src = stdenv.mkDerivation (mylibs.fetchedGithub ./etherpad-lite.json // rec {
+    nodeEnv = callPackage nodeEnv {};
+    src = stdenv.mkDerivation {
+      pname = "etherpad-lite";
+      version = src.version;
+      inherit src;
       patches = [ ./libreoffice_patch.diff ];
       buildPhase = ''
         touch src/.ep_initialized
@@ -46,18 +49,20 @@ let
       installPhase = ''
         cp -a src/ $out
         '';
-    });
+    };
   }).package;
   package = stdenv.mkDerivation rec {
-    name = (mylibs.fetchedGithub ./etherpad-lite.json).name;
+    name = "etherpad-lite-${src.version}";
     src = node-environment;
+    version = src.version;
     installPhase = ''
       mkdir -p $out
       mkdir $out/node_modules
       cp -a lib/node_modules/ep_etherpad-lite $out/src
       chmod u+w $out/src/static/js/
       ln -s ../src $out/node_modules/ep_etherpad-lite
+      ln -s ${varDir}/var $out/var
       '';
-    passthru = toPassthru package;
+    passthru = toPassthru package [];
   };
 in package