summary refs log tree commit diff
path: root/pkgs/applications/networking/irc/thelounge/default.nix
diff options
context:
space:
mode:
authorWinter <winter@winter.cafe>2023-05-22 18:20:22 -0400
committerWinter <winter@winter.cafe>2023-05-28 00:47:54 -0400
commit41bb263d28f1a3a3c4dbc6ce21d462cebd94ac71 (patch)
tree150963f2028bec47e5dcba2416c0f0eea54bfc11 /pkgs/applications/networking/irc/thelounge/default.nix
parentf9138c5ad63c9c5d1a6266d0b37ee85ef4f6ff05 (diff)
downloadnixpkgs-41bb263d28f1a3a3c4dbc6ce21d462cebd94ac71.tar
nixpkgs-41bb263d28f1a3a3c4dbc6ce21d462cebd94ac71.tar.gz
nixpkgs-41bb263d28f1a3a3c4dbc6ce21d462cebd94ac71.tar.bz2
nixpkgs-41bb263d28f1a3a3c4dbc6ce21d462cebd94ac71.tar.lz
nixpkgs-41bb263d28f1a3a3c4dbc6ce21d462cebd94ac71.tar.xz
nixpkgs-41bb263d28f1a3a3c4dbc6ce21d462cebd94ac71.tar.zst
nixpkgs-41bb263d28f1a3a3c4dbc6ce21d462cebd94ac71.zip
thelounge: fix build
Upstream switched to using TypeScript in v4.4.0, which broke the patch.
This fixes that issue by migrating to building The Lounge from source,
instead of having to patch the minified JavaScript.
Diffstat (limited to 'pkgs/applications/networking/irc/thelounge/default.nix')
-rw-r--r--pkgs/applications/networking/irc/thelounge/default.nix71
1 files changed, 71 insertions, 0 deletions
diff --git a/pkgs/applications/networking/irc/thelounge/default.nix b/pkgs/applications/networking/irc/thelounge/default.nix
new file mode 100644
index 00000000000..bee360d55e6
--- /dev/null
+++ b/pkgs/applications/networking/irc/thelounge/default.nix
@@ -0,0 +1,71 @@
+{ lib, stdenv, fetchFromGitHub, fetchYarnDeps, yarn, fixup_yarn_lock, nodejs, npmHooks, nixosTests }:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "thelounge";
+  version = "4.4.0";
+
+  src = fetchFromGitHub {
+    owner = "thelounge";
+    repo = "thelounge";
+    rev = "v${finalAttrs.version}";
+    hash = "sha256-2MHq71lKkFe1uHEENgUiYsO99bPyLmEZZIdcdgsZfSM=";
+  };
+
+  # Allow setting package path for the NixOS module.
+  patches = [ ./packages-path.patch ];
+
+  # Use the NixOS module's state directory by default.
+  postPatch = ''
+    echo /var/lib/thelounge > .thelounge_home
+  '';
+
+  offlineCache = fetchYarnDeps {
+    yarnLock = "${finalAttrs.src}/yarn.lock";
+    hash = "sha256-OKLsNGl94EDyLgP2X2tiwihgRQFXGvf5XgXwgX+JEpk=";
+  };
+
+  nativeBuildInputs = [ nodejs yarn fixup_yarn_lock npmHooks.npmInstallHook ];
+
+  configurePhase = ''
+    runHook preConfigure
+
+    export HOME="$PWD"
+
+    fixup_yarn_lock yarn.lock
+    yarn config --offline set yarn-offline-mirror ${finalAttrs.offlineCache}
+    yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
+    patchShebangs node_modules
+
+    runHook postConfigure
+  '';
+
+  buildPhase = ''
+    runHook preBuild
+
+    NODE_ENV=production yarn build
+
+    runHook postBuild
+  '';
+
+  # `npm prune` doesn't work and/or hangs for whatever reason.
+  preInstall = ''
+    rm -rf node_modules
+    yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive --production
+  '';
+
+  dontNpmPrune = true;
+
+  # Takes way, way, way too long.
+  dontStrip = true;
+
+  passthru.tests = nixosTests.thelounge;
+
+  meta = with lib; {
+    description = "Modern, responsive, cross-platform, self-hosted web IRC client";
+    homepage = "https://thelounge.chat";
+    changelog = "https://github.com/thelounge/thelounge/releases/tag/v${finalAttrs.version}";
+    maintainers = with maintainers; [ winter raitobezarius ];
+    license = licenses.mit;
+    inherit (nodejs.meta) platforms;
+  };
+})