Merge pull request #140904 from dpausp/discourse-new-plugins

Discourse: add plugins: assign, chat-integration, docs, prometheus, saved-searches

authored by Kim Lindberger and committed by GitHub b4ef544b b56f93ab

+210
+6
pkgs/servers/web-apps/discourse/plugins/all-plugins.nix
··· 3 3 callPackage = newScope args; 4 4 in 5 5 { 6 + discourse-assign = callPackage ./discourse-assign {}; 6 7 discourse-calendar = callPackage ./discourse-calendar {}; 7 8 discourse-canned-replies = callPackage ./discourse-canned-replies {}; 9 + discourse-chat-integration = callPackage ./discourse-chat-integration {}; 8 10 discourse-checklist = callPackage ./discourse-checklist {}; 9 11 discourse-data-explorer = callPackage ./discourse-data-explorer {}; 12 + discourse-docs = callPackage ./discourse-docs {}; 10 13 discourse-github = callPackage ./discourse-github {}; 11 14 discourse-ldap-auth = callPackage ./discourse-ldap-auth {}; 12 15 discourse-math = callPackage ./discourse-math {}; 13 16 discourse-migratepassword = callPackage ./discourse-migratepassword {}; 14 17 discourse-openid-connect = callPackage ./discourse-openid-connect {}; 18 + discourse-prometheus = callPackage ./discourse-prometheus {}; 19 + discourse-saved-searches = callPackage ./discourse-saved-searches {}; 15 20 discourse-solved = callPackage ./discourse-solved {}; 16 21 discourse-spoiler-alert = callPackage ./discourse-spoiler-alert {}; 22 + discourse-voting = callPackage ./discourse-voting {}; 17 23 discourse-yearly-review = callPackage ./discourse-yearly-review {}; 18 24 }
+17
pkgs/servers/web-apps/discourse/plugins/discourse-assign/default.nix
··· 1 + { lib, mkDiscoursePlugin, fetchFromGitHub }: 2 + 3 + mkDiscoursePlugin { 4 + name = "discourse-assign"; 5 + src = fetchFromGitHub { 6 + owner = "discourse"; 7 + repo = "discourse-assign"; 8 + rev = "5124ba0f67e26a075f0a0fc8993273f1211d1c28"; 9 + sha256 = "1zd2irp5siza0vd5rlwzmjfvcdfw785988jc526xc741flazk1lr"; 10 + }; 11 + meta = with lib; { 12 + homepage = "https://github.com/discourse/discourse-docs"; 13 + maintainers = with maintainers; [ dpausp ]; 14 + license = licenses.mit; 15 + description = "Discourse Plugin for assigning users to a topic"; 16 + }; 17 + }
+17
pkgs/servers/web-apps/discourse/plugins/discourse-chat-integration/default.nix
··· 1 + { lib, mkDiscoursePlugin, fetchFromGitHub }: 2 + 3 + mkDiscoursePlugin { 4 + name = "discourse-chat-integration"; 5 + src = fetchFromGitHub { 6 + owner = "discourse"; 7 + repo = "discourse-chat-integration"; 8 + rev = "8ade892b387f0ce843d5e78ef4a271b0d35847ff"; 9 + sha256 = "1qn1bm09i9gzmh74ws32zgc89hrqzyhmh63qvmv0h00r52rmgxvx"; 10 + }; 11 + meta = with lib; { 12 + homepage = "https://github.com/discourse/discourse-chat-integration"; 13 + maintainers = with maintainers; [ dpausp ]; 14 + license = licenses.mit; 15 + description = "This plugin integrates Discourse with a number of external chatroom systems"; 16 + }; 17 + }
+17
pkgs/servers/web-apps/discourse/plugins/discourse-docs/default.nix
··· 1 + { lib, mkDiscoursePlugin, fetchFromGitHub }: 2 + 3 + mkDiscoursePlugin { 4 + name = "discourse-docs"; 5 + src = fetchFromGitHub { 6 + owner = "discourse"; 7 + repo = "discourse-docs"; 8 + rev = "72cdd8d415ae3f797c0d5e2c857370714a42c54a"; 9 + sha256 = "07hvw8lpg8873vhwh8rrbml3s5hq606b7sw93r2xv38gxfhmx5lq"; 10 + }; 11 + meta = with lib; { 12 + homepage = "https://github.com/discourse/discourse-docs"; 13 + maintainers = with maintainers; [ dpausp ]; 14 + license = licenses.mit; 15 + description = "Find and filter knowledge base topics"; 16 + }; 17 + }
+8
pkgs/servers/web-apps/discourse/plugins/discourse-prometheus/Gemfile
··· 1 + # frozen_string_literal: true 2 + 3 + source "https://rubygems.org" 4 + 5 + git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } 6 + 7 + # gem "rails" 8 + gem 'prometheus_exporter', '0.5.0'
+13
pkgs/servers/web-apps/discourse/plugins/discourse-prometheus/Gemfile.lock
··· 1 + GEM 2 + remote: https://rubygems.org/ 3 + specs: 4 + prometheus_exporter (0.5.0) 5 + 6 + PLATFORMS 7 + ruby 8 + 9 + DEPENDENCIES 10 + prometheus_exporter (= 0.5.0) 11 + 12 + BUNDLED WITH 13 + 2.1.4
+26
pkgs/servers/web-apps/discourse/plugins/discourse-prometheus/default.nix
··· 1 + { lib, stdenv, mkDiscoursePlugin, fetchFromGitHub }: 2 + 3 + mkDiscoursePlugin { 4 + bundlerEnvArgs.gemdir = ./.; 5 + name = "discourse-prometheus"; 6 + src = fetchFromGitHub { 7 + owner = "discourse"; 8 + repo = "discourse-prometheus"; 9 + rev = "46260710e8770344af438f86b47409d864a1c499"; 10 + sha256 = "0nmpi0nysp59x4hyn1c3niypvxw1jkz86acb6m8acacw0c6682k2"; 11 + }; 12 + 13 + patches = [ 14 + # The metrics collector tries to run git to get the commit id but fails 15 + # because we don't run Discourse from a Git repository. 16 + ./no-git-version.patch 17 + ./spec-import-fix-abi-version.patch 18 + ]; 19 + 20 + meta = with lib; { 21 + homepage = "https://github.com/discourse/discourse-prometheus"; 22 + maintainers = with maintainers; [ dpausp ]; 23 + license = licenses.mit; 24 + description = "Official Discourse Plugin for Prometheus Monitoring"; 25 + }; 26 + }
+12
pkgs/servers/web-apps/discourse/plugins/discourse-prometheus/gemset.nix
··· 1 + { 2 + prometheus_exporter = { 3 + groups = ["default"]; 4 + platforms = []; 5 + source = { 6 + remotes = ["https://rubygems.org"]; 7 + sha256 = "1kmabnxz466zqnyqlzc693ny4l7i0rxvmc0znswvizc0zg4pri80"; 8 + type = "gem"; 9 + }; 10 + version = "0.5.0"; 11 + }; 12 + }
+36
pkgs/servers/web-apps/discourse/plugins/discourse-prometheus/no-git-version.patch
··· 1 + diff --git a/lib/internal_metric/global.rb b/lib/internal_metric/global.rb 2 + index 682571b..7bdd431 100644 3 + --- a/lib/internal_metric/global.rb 4 + +++ b/lib/internal_metric/global.rb 5 + @@ -30,30 +30,7 @@ module DiscoursePrometheus::InternalMetric 6 + @active_app_reqs = 0 7 + @queued_app_reqs = 0 8 + @fault_logged = {} 9 + - 10 + - begin 11 + - @@version = nil 12 + - 13 + - out, error, status = Open3.capture3('git rev-parse HEAD') 14 + - 15 + - if status.success? 16 + - @@version ||= out.chomp 17 + - else 18 + - raise error 19 + - end 20 + - rescue => e 21 + - if defined?(::Discourse) 22 + - Discourse.warn_exception(e, message: "Failed to calculate discourse_version_info metric") 23 + - else 24 + - STDERR.puts "Failed to calculate discourse_version_info metric: #{e}\n#{e.backtrace.join("\n")}" 25 + - end 26 + - 27 + - @@retries ||= 10 28 + - @@retries -= 1 29 + - if @@retries < 0 30 + - @@version = -1 31 + - end 32 + - end 33 + + @@version = -1 34 + end 35 + 36 + def collect
+16
pkgs/servers/web-apps/discourse/plugins/discourse-prometheus/spec-import-fix-abi-version.patch
··· 1 + diff --git a/bin/collector b/bin/collector 2 + index 4fec65e..e59eac7 100755 3 + --- a/bin/collector 4 + +++ b/bin/collector 5 + @@ -3,8 +3,10 @@ 6 + 7 + Process.setproctitle("discourse prometheus-collector") 8 + 9 + +# We need the ABI version {MAJOR}.{MINOR}.0 here. 10 + +abi_version = ENV['GEM_PATH'].split("/")[-1] 11 + version = File.read(File.expand_path("../../prometheus_exporter_version", __FILE__)).strip 12 + -spec_file = File.expand_path("../../gems/#{RUBY_VERSION}/specifications/prometheus_exporter-#{version}.gemspec", __FILE__) 13 + +spec_file = File.expand_path("../../gems/#{abi_version}/specifications/prometheus_exporter-#{version}.gemspec", __FILE__) 14 + 15 + spec = Gem::Specification.load spec_file 16 + spec.activate
+17
pkgs/servers/web-apps/discourse/plugins/discourse-saved-searches/default.nix
··· 1 + { lib, mkDiscoursePlugin, fetchFromGitHub }: 2 + 3 + mkDiscoursePlugin { 4 + name = "discourse-saved-searches"; 5 + src = fetchFromGitHub { 6 + owner = "discourse"; 7 + repo = "discourse-saved-searches"; 8 + rev = "b59e0b60afdd5133e60c5cc6169f42f1edd746be"; 9 + sha256 = "0yhr7gx35q2nshvfxkplplkq73l7sgqlm8r3g1apniqicpk5flqy"; 10 + }; 11 + meta = with lib; { 12 + homepage = "https://github.com/discourse/discourse-saved-searches"; 13 + maintainers = with maintainers; [ dpausp ]; 14 + license = licenses.mit; 15 + description = "Allow users to save searches and be notified of new results"; 16 + }; 17 + }
+17
pkgs/servers/web-apps/discourse/plugins/discourse-voting/default.nix
··· 1 + { lib, mkDiscoursePlugin, fetchFromGitHub }: 2 + 3 + mkDiscoursePlugin { 4 + name = "discourse-voting"; 5 + src = fetchFromGitHub { 6 + owner = "discourse"; 7 + repo = "discourse-voting"; 8 + rev = "fc4d23174eba1a57ddcba93eaf4a4e75d469d4a4"; 9 + sha256 = "07mj667qn387kaafg475f36pgnannsrb2bdqi0zj487av43252qb"; 10 + }; 11 + meta = with lib; { 12 + homepage = "https://github.com/discourse/discourse-voting"; 13 + maintainers = with maintainers; [ dpausp ]; 14 + license = licenses.gpl2Only; 15 + description = "Adds the ability for voting on a topic within a specified category in Discourse"; 16 + }; 17 + }
+8
pkgs/servers/web-apps/discourse/update.py
··· 201 201 202 202 """ 203 203 plugins = [ 204 + {'name': 'discourse-assign'}, 204 205 {'name': 'discourse-calendar'}, 205 206 {'name': 'discourse-canned-replies'}, 207 + {'name': 'discourse-chat-integration'}, 206 208 {'name': 'discourse-checklist'}, 207 209 {'name': 'discourse-data-explorer'}, 210 + {'name': 'discourse-docs'}, 208 211 {'name': 'discourse-github'}, 209 212 {'name': 'discourse-ldap-auth', 'owner': 'jonmbake'}, 210 213 {'name': 'discourse-math'}, 211 214 {'name': 'discourse-migratepassword', 'owner': 'discoursehosting'}, 215 + # We can't update this automatically at the moment because the plugin.rb 216 + # tries to load a version number which breaks bundler called by this script. 217 + # {'name': 'discourse-prometheus'}, 218 + {'name': 'discourse-saved-searches'}, 212 219 {'name': 'discourse-solved'}, 213 220 {'name': 'discourse-spoiler-alert'}, 221 + {'name': 'discourse-voting'}, 214 222 {'name': 'discourse-yearly-review'}, 215 223 ] 216 224