Commit d80dd12

HPCesia <me@hpcesia.com>
2026-07-07 10:40:12
new package: artalk
It's just replaced pnpm_9 to pnpm_10 in Nixpkgs's ver.
1 parent b497d72
Changed files (4)
pkgs/artalk/default.nix
@@ -0,0 +1,61 @@
+{
+  lib,
+  buildGoModule,
+  fetchFromGitHub,
+  installShellFiles,
+  versionCheckHook,
+  stdenv,
+  nixosTests,
+  callPackage,
+  artalk-frontend ? callPackage ./frontend.nix {},
+}: let
+  pname = "artalk";
+  version = "2.9.1";
+
+  src = fetchFromGitHub {
+    owner = "ArtalkJS";
+    repo = "artalk";
+    tag = "v${version}";
+    hash = "sha256-gzagE3muNpX/dwF45p11JAN9ElsGXNFQ3fCvF1QhvdU=";
+  };
+in
+  buildGoModule {
+    inherit src pname version;
+
+    vendorHash = "sha256-oAqYQzOUjly97H5L5PQ9I2SO2KqiUVxdJA+eoPrHD6Q=";
+
+    ldflags = [
+      "-s"
+      "-w"
+    ];
+
+    preBuild = ''
+      cp -r ${artalk-frontend}/* ./public
+    '';
+
+    nativeBuildInputs = [installShellFiles];
+
+    postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
+      installShellCompletion --cmd artalk \
+        --bash <($out/bin/artalk completion bash) \
+        --fish <($out/bin/artalk completion fish) \
+        --zsh <($out/bin/artalk completion zsh)
+    '';
+
+    doInstallCheck = true;
+    nativeInstallCheckInputs = [versionCheckHook];
+    versionCheckProgramArg = "-v";
+
+    passthru.tests = {
+      inherit (nixosTests) artalk;
+    };
+
+    meta = {
+      description = "Self-hosted comment system";
+      homepage = "https://github.com/ArtalkJS/Artalk";
+      changelog = "https://github.com/ArtalkJS/Artalk/releases/tag/v${version}";
+      license = lib.licenses.mit;
+      maintainers = with lib.maintainers; [moraxyc];
+      mainProgram = "artalk";
+    };
+  }
pkgs/artalk/frontend.nix
@@ -0,0 +1,60 @@
+{
+  fetchFromGitHub,
+  nodejs,
+  pnpm_10,
+  fetchPnpmDeps,
+  pnpmConfigHook,
+  stdenv,
+  lib,
+}: let
+  pname = "artalk-frontend";
+  version = "2.9.1";
+
+  src = fetchFromGitHub {
+    owner = "ArtalkJS";
+    repo = "artalk";
+    tag = "v${version}";
+    hash = "sha256-gzagE3muNpX/dwF45p11JAN9ElsGXNFQ3fCvF1QhvdU=";
+  };
+in
+  stdenv.mkDerivation (finalAttrs: {
+    inherit pname version src;
+
+    nativeBuildInputs = [
+      nodejs
+      pnpmConfigHook
+      pnpm_10
+    ];
+
+    pnpmDeps = fetchPnpmDeps {
+      inherit (finalAttrs) pname version src;
+      pnpm = pnpm_10;
+      fetcherVersion = 3;
+      hash = "sha256-dss1p/8YSR2TcT2zUoFiJnBLaUyeAA+l5wNLtJAfupo=";
+    };
+
+    buildPhase = ''
+      runHook preBuild
+
+      pnpm build:all
+      pnpm build:auth
+
+      runHook postBuild
+    '';
+
+    installPhase = ''
+      runHook preInstall
+
+      mkdir -p $out/{dist/{i18n,plugins},sidebar}
+
+      # dist
+      cp ./ui/artalk/dist/{Artalk,ArtalkLite}.{css,js} $out/dist
+      cp ./ui/artalk/dist/i18n/*.js $out/dist/i18n
+      cp ./ui/plugin-*/dist/*.js $out/dist/plugins
+
+      # sidebar
+      cp -r ./ui/artalk-sidebar/dist/* $out/sidebar
+
+      runHook postInstall
+    '';
+  })
default.nix
@@ -19,6 +19,8 @@ in {
   # flakeModules = { }; # flake-parts modules
   overlays = import ./overlays; # nixpkgs overlays
 
+  artalk = callPackage ./pkgs/artalk {};
+
   dwproton-bin = callPackage ./pkgs/dwproton-bin {};
 
   elio = callPackage ./pkgs/elio {};
README.md
@@ -11,6 +11,7 @@
 
 | Path | Name | Version | License | Description |
 | --- | --- | --- | --- | --- |
+| `artalk` | [artalk](https://github.com/ArtalkJS/Artalk) | `2.9.1` | [MIT](https://spdx.org/licenses/MIT.html) | Self-hosted comment system |
 | `dwproton-bin` | [dwproton](https://dawn.wine/dawn-winery/dwproton) | `11.0-5` | [BSD-3-Clause](https://spdx.org/licenses/BSD-3-Clause.html) | Dawn Winery's custom Proton fork with fixes for various games |
 | `elio` | [elio](https://github.com/elio-fm/elio) | `1.8.0` | [MIT](https://spdx.org/licenses/MIT.html) | Snappy, batteries-included terminal file manager with rich previews, inline images, bulk actions, and trash support |
 | `gitmal` | [gitmal](https://github.com/antonmedv/gitmal) | `1.0.2` | [MIT](https://spdx.org/licenses/MIT.html) |  A static page generator for repos |