summary refs log tree commit diff
path: root/pkgs/servers/web-apps/lemmy
diff options
context:
space:
mode:
authorhappysalada <raphael@megzari.com>2021-10-03 14:51:06 +0900
committerhappysalada <raphael@megzari.com>2021-10-03 14:51:06 +0900
commit5e7aab598257d7f0cde7c9fe2617c8801e224b9d (patch)
tree9c1827f33c3f8b1c388e421345ef6f4a3c2d981d /pkgs/servers/web-apps/lemmy
parent82155ff501c7622cb2336646bb62f7624261f6d7 (diff)
lemmy-ui: add static assets folder to out
Diffstat (limited to 'pkgs/servers/web-apps/lemmy')
-rw-r--r--pkgs/servers/web-apps/lemmy/ui.nix75
1 files changed, 37 insertions, 38 deletions
diff --git a/pkgs/servers/web-apps/lemmy/ui.nix b/pkgs/servers/web-apps/lemmy/ui.nix
index 0d2deda538718..e554a1213e70b 100644
--- a/pkgs/servers/web-apps/lemmy/ui.nix
+++ b/pkgs/servers/web-apps/lemmy/ui.nix
@@ -4,7 +4,6 @@
 , nodejs
 , python3
 , pkg-config
-, writeShellScriptBin
 , fetchFromGitHub
 }:
 
@@ -22,53 +21,53 @@ let
 
   name = "lemmy-ui";
   version = "0.12.2";
-  unwrapped = mkYarnPackage {
+in
+mkYarnPackage {
 
-    src = fetchFromGitHub {
-      owner = "LemmyNet";
-      repo = name;
-      rev = version;
-      fetchSubmodules = true;
-      sha256 = "sha256-iFLJqUnz4m9/JTSaJSUugzY5KkiKtH0sMYY4ALm2Ebk=";
-    };
+  src = fetchFromGitHub {
+    owner = "LemmyNet";
+    repo = name;
+    rev = version;
+    fetchSubmodules = true;
+    sha256 = "sha256-iFLJqUnz4m9/JTSaJSUugzY5KkiKtH0sMYY4ALm2Ebk=";
+  };
 
-    inherit pkgConfig name version;
+  inherit pkgConfig name version;
 
-    extraBuildInputs = [ libsass ];
+  extraBuildInputs = [ libsass ];
 
-    yarnNix = ./yarn.nix;
+  yarnNix = ./yarn.nix;
 
-    # Fails mysteriously on source/package.json
-    # Upstream package.json is missing a newline at the end
-    packageJSON = ./package.json;
+  # Fails mysteriously on source/package.json
+  # Upstream package.json is missing a newline at the end
+  packageJSON = ./package.json;
 
-    yarnPreBuild = ''
-      export npm_config_nodedir=${nodejs}
-    '';
+  yarnPreBuild = ''
+    export npm_config_nodedir=${nodejs}
+  '';
 
-    buildPhase = ''
-      # Yarn writes cache directories etc to $HOME.
-      export HOME=$PWD/yarn_home
+  buildPhase = ''
+    # Yarn writes cache directories etc to $HOME.
+    export HOME=$PWD/yarn_home
 
-      ln -sf $PWD/node_modules $PWD/deps/lemmy-ui/
+    ln -sf $PWD/node_modules $PWD/deps/lemmy-ui/
 
-      yarn --offline build:prod
-    '';
+    yarn --offline build:prod
+  '';
 
-    distPhase = "true";
+  preInstall = ''
+    mkdir $out
+    cp -R ./deps/lemmy-ui/dist/assets $out
+  '';
 
-    meta = with lib; {
-      description = "Building a federated alternative to reddit in rust";
-      homepage = "https://join-lemmy.org/";
-      license = licenses.agpl3Only;
-      maintainers = with maintainers; [ happysalada billewanick ];
-      platforms = platforms.linux;
-    };
+  distPhase = "true";
+
+  meta = with lib; {
+    description = "Building a federated alternative to reddit in rust";
+    homepage = "https://join-lemmy.org/";
+    license = licenses.agpl3Only;
+    maintainers = with maintainers; [ happysalada billewanick ];
+    platforms = platforms.linux;
   };
-in
-(writeShellScriptBin "lemmy-ui" ''
-  ${nodejs}/bin/node ${unwrapped}/libexec/lemmy-ui/node_modules/lemmy-ui/dist/js/server.js
-'').overrideAttrs (oldAttrs: {
-  passthru = { inherit unwrapped; };
-})
+}