X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=flakes%2Fetherpad-lite%2Fdefault.nix;fp=pkgs%2Fwebapps%2Fetherpad-lite%2Fdefault.nix;h=1dd5aa4302293ce768e9bc7fd1de9f8f5f5f829b;hb=1a64deeb894dc95e2645a75771732c6cc53a79ad;hp=4327384840be37ad7dc8ec812c368bcf2a5e9e27;hpb=fa25ffd4583cc362075cd5e1b4130f33306103f0;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/pkgs/webapps/etherpad-lite/default.nix b/flakes/etherpad-lite/default.nix similarity index 77% rename from pkgs/webapps/etherpad-lite/default.nix rename to flakes/etherpad-lite/default.nix index 4327384..1dd5aa4 100644 --- a/pkgs/webapps/etherpad-lite/default.nix +++ b/flakes/etherpad-lite/default.nix @@ -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