From 3c3cd970250b39ac7aa011000f0639edcef6ca38 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Mon, 2 Aug 2021 14:54:52 -0700 Subject: [PATCH 01/18] discourseAllPlugins: init discourse-checklist (cherry picked from commit eb02dc0c4a14d5a15f3443567bc12abf631c300a) --- .../web-apps/discourse/plugins/all-plugins.nix | 1 + .../plugins/discourse-checklist/default.nix | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 pkgs/servers/web-apps/discourse/plugins/discourse-checklist/default.nix diff --git a/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix b/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix index f64fbb137df..18a880063b9 100644 --- a/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix +++ b/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix @@ -4,6 +4,7 @@ let in { discourse-canned-replies = callPackage ./discourse-canned-replies {}; + discourse-checklist = callPackage ./discourse-checklist {}; discourse-github = callPackage ./discourse-github {}; discourse-math = callPackage ./discourse-math {}; discourse-solved = callPackage ./discourse-solved {}; diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-checklist/default.nix b/pkgs/servers/web-apps/discourse/plugins/discourse-checklist/default.nix new file mode 100644 index 00000000000..89edb3f71d7 --- /dev/null +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-checklist/default.nix @@ -0,0 +1,17 @@ +{ lib, mkDiscoursePlugin, fetchFromGitHub }: + +mkDiscoursePlugin { + name = "discourse-checklist"; + src = fetchFromGitHub { + owner = "discourse"; + repo = "discourse-checklist"; + rev = "6e7b9c5040c55795c7fd4db9569b3e93dad092c2"; + sha256 = "sha256-2KAVBrfAvhLZC9idi+ijbVqOCq9rSXbDVEOZS+mWJ10="; + }; + meta = with lib; { + homepage = "https://github.com/discourse/discourse-checklist"; + maintainers = with maintainers; [ ryantm ]; + license = licenses.gpl2Only; + description = "A simple checklist rendering plugin for discourse "; + }; +} From d0064e3868cb8f19a2f4063776938dbf7e49159c Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Mon, 2 Aug 2021 15:01:58 -0700 Subject: [PATCH 02/18] discourseAllPlugins: init discourse-data-explorer (cherry picked from commit 601db31c264f3008c25f3fb13f1968a543a9cfe6) --- .../web-apps/discourse/plugins/all-plugins.nix | 1 + .../plugins/discourse-data-explorer/default.nix | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 pkgs/servers/web-apps/discourse/plugins/discourse-data-explorer/default.nix diff --git a/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix b/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix index 18a880063b9..cda5041ae3b 100644 --- a/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix +++ b/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix @@ -5,6 +5,7 @@ in { discourse-canned-replies = callPackage ./discourse-canned-replies {}; discourse-checklist = callPackage ./discourse-checklist {}; + discourse-data-explorer = callPackage ./discourse-data-explorer {}; discourse-github = callPackage ./discourse-github {}; discourse-math = callPackage ./discourse-math {}; discourse-solved = callPackage ./discourse-solved {}; diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-data-explorer/default.nix b/pkgs/servers/web-apps/discourse/plugins/discourse-data-explorer/default.nix new file mode 100644 index 00000000000..983c8b7fe83 --- /dev/null +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-data-explorer/default.nix @@ -0,0 +1,17 @@ +{ lib, mkDiscoursePlugin, fetchFromGitHub }: + +mkDiscoursePlugin { + name = "discourse-data-explorer"; + src = fetchFromGitHub { + owner = "discourse"; + repo = "discourse-data-explorer"; + rev = "7a348aaa8b2a6b3a75db72e99a7370a1a6fcb2b8"; + sha256 = "sha256-4X0oor3dIKrQO5IrScQ9+DBr39R7PJJ8dg9UQseV6IU="; + }; + meta = with lib; { + homepage = "https://github.com/discourse/discourse-data-explorer"; + maintainers = with maintainers; [ ryantm ]; + license = licenses.mit; + description = "SQL Queries for admins in Discourse"; + }; +} From a9358e80fcb5add861afa4099efa4b3432d40379 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Mon, 2 Aug 2021 15:21:53 -0700 Subject: [PATCH 03/18] discourseAllPlugins: init discourse-migratepassword (cherry picked from commit 85d7eb75c968421ea233f4c8a5b05886733c2dec) --- .../discourse/plugins/all-plugins.nix | 1 + .../plugins/discourse-migratepassword/Gemfile | 6 +++++ .../discourse-migratepassword/Gemfile.lock | 15 +++++++++++++ .../discourse-migratepassword/default.nix | 18 +++++++++++++++ .../discourse-migratepassword/gemset.nix | 22 +++++++++++++++++++ 5 files changed, 62 insertions(+) create mode 100644 pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/Gemfile create mode 100644 pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/Gemfile.lock create mode 100644 pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/default.nix create mode 100644 pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/gemset.nix diff --git a/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix b/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix index cda5041ae3b..37f0a6b8681 100644 --- a/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix +++ b/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix @@ -8,6 +8,7 @@ in discourse-data-explorer = callPackage ./discourse-data-explorer {}; discourse-github = callPackage ./discourse-github {}; discourse-math = callPackage ./discourse-math {}; + discourse-migratepassword = callPackage ./discourse-migratepassword {}; discourse-solved = callPackage ./discourse-solved {}; discourse-spoiler-alert = callPackage ./discourse-spoiler-alert {}; discourse-yearly-review = callPackage ./discourse-yearly-review {}; diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/Gemfile b/pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/Gemfile new file mode 100644 index 00000000000..0fcdf01d56f --- /dev/null +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/Gemfile @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem 'bcrypt', '3.1.3' +gem 'unix-crypt', '1.3.0' diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/Gemfile.lock b/pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/Gemfile.lock new file mode 100644 index 00000000000..2c9fb904930 --- /dev/null +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/Gemfile.lock @@ -0,0 +1,15 @@ +GEM + remote: https://rubygems.org/ + specs: + bcrypt (3.1.3) + unix-crypt (1.3.0) + +PLATFORMS + x86_64-linux + +DEPENDENCIES + bcrypt (= 3.1.3) + unix-crypt (= 1.3.0) + +BUNDLED WITH + 2.2.20 diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/default.nix b/pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/default.nix new file mode 100644 index 00000000000..4c46dfb181e --- /dev/null +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/default.nix @@ -0,0 +1,18 @@ +{ lib, mkDiscoursePlugin, fetchFromGitHub }: + +mkDiscoursePlugin { + name = "discourse-migratepassword"; + bundlerEnvArgs.gemdir = ./.; + src = fetchFromGitHub { + owner = "communiteq"; + repo = "discourse-migratepassword"; + rev = "91d6a008de91853becca01846aa4662bd227670e"; + sha256 = "sha256-aKj0zXyXDnG20qVdhGvn4fwXiBeHFj2pv4bTUP81MP0="; + }; + meta = with lib; { + homepage = "https://github.com/communiteq/discourse-migratepassword"; + maintainers = with maintainers; [ ryantm ]; + license = licenses.gpl2Only; + description = "Support migrated password hashes"; + }; +} diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/gemset.nix b/pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/gemset.nix new file mode 100644 index 00000000000..22b4053bbd4 --- /dev/null +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-migratepassword/gemset.nix @@ -0,0 +1,22 @@ +{ + bcrypt = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1d2gqv8vry4ps0asb7nn1z4zxi3mcscy7yrim0npdd294ffyinvj"; + type = "gem"; + }; + version = "3.1.3"; + }; + unix-crypt = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1wflipsmmicmgvqilp9pml4x19b337kh6p6jgrzqrzpkq2z52gdq"; + type = "gem"; + }; + version = "1.3.0"; + }; +} From 48f779f37de2917b0a3e343c16bc8dca351507b3 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Thu, 5 Aug 2021 10:16:15 -0700 Subject: [PATCH 04/18] discourse/update.py: add missing plugins (cherry picked from commit 32e24e792caefa1de46bf20da2ba4d8fbbf035dc) --- pkgs/servers/web-apps/discourse/update.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/servers/web-apps/discourse/update.py b/pkgs/servers/web-apps/discourse/update.py index ae4dadfc3a7..4832e8638ea 100755 --- a/pkgs/servers/web-apps/discourse/update.py +++ b/pkgs/servers/web-apps/discourse/update.py @@ -187,9 +187,13 @@ def update_plugins(): """ plugins = [ + {'name': 'discourse-calendar'}, {'name': 'discourse-canned-replies'}, + {'name': 'discourse-checklist'}, + {'name': 'discourse-data-explorer'}, {'name': 'discourse-github'}, {'name': 'discourse-math'}, + {'name': 'discourse-migratepassword', 'owner': 'discoursehosting'}, {'name': 'discourse-solved'}, {'name': 'discourse-spoiler-alert'}, {'name': 'discourse-yearly-review'}, From 8b8ccc0fd8efa8634b7deafb12b8b43ab2231506 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Tue, 27 Jul 2021 13:44:58 -0700 Subject: [PATCH 05/18] discourseAllPlugins: add discourse-calendar (cherry picked from commit 858b0157e56426ee0d56faae393fc85b361ffd90) --- .../discourse/plugins/all-plugins.nix | 1 + .../plugins/discourse-calendar/Gemfile | 5 ++ .../plugins/discourse-calendar/Gemfile.lock | 27 +++++++ .../plugins/discourse-calendar/default.nix | 18 +++++ .../plugins/discourse-calendar/gemset.nix | 76 +++++++++++++++++++ 5 files changed, 127 insertions(+) create mode 100644 pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile create mode 100644 pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile.lock create mode 100644 pkgs/servers/web-apps/discourse/plugins/discourse-calendar/default.nix create mode 100644 pkgs/servers/web-apps/discourse/plugins/discourse-calendar/gemset.nix diff --git a/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix b/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix index 37f0a6b8681..27c749dea2e 100644 --- a/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix +++ b/pkgs/servers/web-apps/discourse/plugins/all-plugins.nix @@ -3,6 +3,7 @@ let callPackage = newScope args; in { + discourse-calendar = callPackage ./discourse-calendar {}; discourse-canned-replies = callPackage ./discourse-canned-replies {}; discourse-checklist = callPackage ./discourse-checklist {}; discourse-data-explorer = callPackage ./discourse-data-explorer {}; diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile new file mode 100644 index 00000000000..8c192fc0385 --- /dev/null +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem 'rrule', '0.4.2', require: false diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile.lock b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile.lock new file mode 100644 index 00000000000..b3c21c857d4 --- /dev/null +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile.lock @@ -0,0 +1,27 @@ +GEM + remote: https://rubygems.org/ + specs: + activesupport (6.1.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + concurrent-ruby (1.1.9) + i18n (1.8.10) + concurrent-ruby (~> 1.0) + minitest (5.14.4) + rrule (0.4.2) + activesupport (>= 4.1) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) + zeitwerk (2.4.2) + +PLATFORMS + x86_64-linux + +DEPENDENCIES + rrule (= 0.4.2) + +BUNDLED WITH + 2.2.20 diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/default.nix b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/default.nix new file mode 100644 index 00000000000..f4f179c07c0 --- /dev/null +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/default.nix @@ -0,0 +1,18 @@ +{ lib, mkDiscoursePlugin, fetchFromGitHub }: + +mkDiscoursePlugin { + name = "discourse-calendar"; + bundlerEnvArgs.gemdir = ./.; + src = fetchFromGitHub { + owner = "discourse"; + repo = "discourse-calendar"; + rev = "567712d8c02640574fbab081eb54b2f26349c88d"; + sha256 = "sha256-r6rfbi/ScbM+SiAjeijXmr5R9wpJxzxGl52X5oV++5w="; + }; + meta = with lib; { + homepage = "https://github.com/discourse/discourse-calendar"; + maintainers = with maintainers; [ ryantm ]; + license = licenses.mit; + description = "Adds the ability to create a dynamic calendar in the first post of a topic"; + }; +} diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/gemset.nix b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/gemset.nix new file mode 100644 index 00000000000..26db0e6fd10 --- /dev/null +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/gemset.nix @@ -0,0 +1,76 @@ +{ + activesupport = { + dependencies = ["concurrent-ruby" "i18n" "minitest" "tzinfo" "zeitwerk"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0kqgywy4cj3h5142dh7pl0xx5nybp25jn0ykk0znziivzks68xdk"; + type = "gem"; + }; + version = "6.1.4"; + }; + concurrent-ruby = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0nwad3211p7yv9sda31jmbyw6sdafzmdi2i2niaz6f0wk5nq9h0f"; + type = "gem"; + }; + version = "1.1.9"; + }; + i18n = { + dependencies = ["concurrent-ruby"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0g2fnag935zn2ggm5cn6k4s4xvv53v2givj1j90szmvavlpya96a"; + type = "gem"; + }; + version = "1.8.10"; + }; + minitest = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "19z7wkhg59y8abginfrm2wzplz7py3va8fyngiigngqvsws6cwgl"; + type = "gem"; + }; + version = "5.14.4"; + }; + rrule = { + dependencies = ["activesupport"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0w338b7dgvd144fl5b8xy2lfc6zgbcjac7b4z158jc8h070yzc9v"; + type = "gem"; + }; + version = "0.4.2"; + }; + tzinfo = { + dependencies = ["concurrent-ruby"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "10qp5x7f9hvlc0psv9gsfbxg4a7s0485wsbq1kljkxq94in91l4z"; + type = "gem"; + }; + version = "2.0.4"; + }; + zeitwerk = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1746czsjarixq0x05f7p3hpzi38ldg6wxnxxw74kbjzh1sdjgmpl"; + type = "gem"; + }; + version = "2.4.2"; + }; +} From c193cf6ed92bc34f341d4f20875a2cdad3958b9f Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Thu, 22 Jul 2021 18:06:55 +0200 Subject: [PATCH 06/18] discourse.mkDiscoursePlugin: remove phases (cherry picked from commit 4f62b051375b0fdaa01ba37e915cfaaa7de40d80) --- pkgs/servers/web-apps/discourse/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/web-apps/discourse/default.nix b/pkgs/servers/web-apps/discourse/default.nix index de171cebd41..8af1d754a05 100644 --- a/pkgs/servers/web-apps/discourse/default.nix +++ b/pkgs/servers/web-apps/discourse/default.nix @@ -65,7 +65,8 @@ let in stdenv.mkDerivation (builtins.removeAttrs args [ "bundlerEnvArgs" ] // { pluginName = if name != null then name else "${pname}-${version}"; - phases = [ "unpackPhase" "installPhase" ]; + dontConfigure = true; + dontBuild = true; installPhase = '' runHook preInstall mkdir -p $out From f2533d47c82d3ede9616d1dd9032c222718bd7bf Mon Sep 17 00:00:00 2001 From: talyz Date: Thu, 12 Aug 2021 12:26:41 +0200 Subject: [PATCH 07/18] discourse: 2.7.5 -> 2.7.7 (cherry picked from commit c97ae4ad8e782765b333840d8d1aa83903f82b7f) --- pkgs/servers/web-apps/discourse/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/web-apps/discourse/default.nix b/pkgs/servers/web-apps/discourse/default.nix index 8af1d754a05..8f680ac575d 100644 --- a/pkgs/servers/web-apps/discourse/default.nix +++ b/pkgs/servers/web-apps/discourse/default.nix @@ -9,13 +9,13 @@ }: let - version = "2.7.5"; + version = "2.7.7"; src = fetchFromGitHub { owner = "discourse"; repo = "discourse"; rev = "v${version}"; - sha256 = "sha256-OykWaiBAHcZy41i+aRzBHCRgwnfQUBijHjb+ofIk25M="; + sha256 = "sha256-rhcTQyirgPX0ITjgotJAYLLSU957GanxAYYhy9j123U="; }; runtimeDeps = [ From 4a30a10e6243e4a1750e9ec17323b03eb48531c8 Mon Sep 17 00:00:00 2001 From: talyz Date: Thu, 12 Aug 2021 12:30:20 +0200 Subject: [PATCH 08/18] discourse.plugins.discourse-calendar: Update (cherry picked from commit d1a63bf19c6c75430393dab94f5e939b258ffdb6) --- .../web-apps/discourse/plugins/discourse-calendar/Gemfile | 3 +++ .../discourse/plugins/discourse-calendar/Gemfile.lock | 2 +- .../web-apps/discourse/plugins/discourse-calendar/default.nix | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile index 8c192fc0385..bda8e6ec3cf 100644 --- a/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile @@ -2,4 +2,7 @@ source "https://rubygems.org" +git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } + +# gem "rails" gem 'rrule', '0.4.2', require: false diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile.lock b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile.lock index b3c21c857d4..d5622c0ac37 100644 --- a/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile.lock +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/Gemfile.lock @@ -18,7 +18,7 @@ GEM zeitwerk (2.4.2) PLATFORMS - x86_64-linux + ruby DEPENDENCIES rrule (= 0.4.2) diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/default.nix b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/default.nix index f4f179c07c0..b610a5c21a1 100644 --- a/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/default.nix +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-calendar/default.nix @@ -6,8 +6,8 @@ mkDiscoursePlugin { src = fetchFromGitHub { owner = "discourse"; repo = "discourse-calendar"; - rev = "567712d8c02640574fbab081eb54b2f26349c88d"; - sha256 = "sha256-r6rfbi/ScbM+SiAjeijXmr5R9wpJxzxGl52X5oV++5w="; + rev = "519cf403ae3003291de20145aca243e2ffbcb4a2"; + sha256 = "0398cf7k03i7j7v5w1mysjzk2npbkvr7icj5sjwa8i8xzg34gck4"; }; meta = with lib; { homepage = "https://github.com/discourse/discourse-calendar"; From fddb277d03d0015e07089dd515592b63a750c172 Mon Sep 17 00:00:00 2001 From: talyz Date: Thu, 12 Aug 2021 12:31:14 +0200 Subject: [PATCH 09/18] discourse.plugins.discourse-canned-replies: Update (cherry picked from commit 5d94e3bfc94637f6876b9957471fc571646867b0) --- .../discourse/plugins/discourse-canned-replies/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-canned-replies/default.nix b/pkgs/servers/web-apps/discourse/plugins/discourse-canned-replies/default.nix index 558abec36f4..f90fabc0574 100644 --- a/pkgs/servers/web-apps/discourse/plugins/discourse-canned-replies/default.nix +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-canned-replies/default.nix @@ -5,8 +5,8 @@ mkDiscoursePlugin { src = fetchFromGitHub { owner = "discourse"; repo = "discourse-canned-replies"; - rev = "e3f1de8928df5955b64994079b7e2073556e5456"; - sha256 = "1g4fazm6cn6hbfd08mq2zhc6dgm4qj1r1f1amhbgxhk6qsxf42cd"; + rev = "672a96a8160d3767cf5fd6647309c7b5dcf8a55d"; + sha256 = "105zgpc7j3xmlkaz3cgxw1rfgy5d3dzln58ix569jmzifbsijml7"; }; meta = with lib; { homepage = "https://github.com/discourse/discourse-canned-replies"; From 700cfb0fc3e03fb9ca6b39e576c460875d84a7cd Mon Sep 17 00:00:00 2001 From: talyz Date: Thu, 12 Aug 2021 12:31:52 +0200 Subject: [PATCH 10/18] discourse.plugins.discourse-solved: Update (cherry picked from commit 92b758266e61b2efe078973a3d020b3d1a2c363d) --- .../web-apps/discourse/plugins/discourse-solved/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-solved/default.nix b/pkgs/servers/web-apps/discourse/plugins/discourse-solved/default.nix index 2d451418bdd..c92c5a1016a 100644 --- a/pkgs/servers/web-apps/discourse/plugins/discourse-solved/default.nix +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-solved/default.nix @@ -5,8 +5,8 @@ mkDiscoursePlugin { src = fetchFromGitHub { owner = "discourse"; repo = "discourse-solved"; - rev = "b96374bf4ab7e6d5cecb0761918b060a524eb9bf"; - sha256 = "0zrv70p0wz93akpcj6gpwjkw7az3iz9bx4n2z630kyrlmxdbj32a"; + rev = "8bf54370200fe9d94541f69339430a7dc1019d62"; + sha256 = "1sk91h4dilkxm1wpv8zw59wgw860ywwlcgiw2kd23ybdk9n7b3lh"; }; meta = with lib; { homepage = "https://github.com/discourse/discourse-solved"; From 202c17a806caf225add54d76ae23df22bbb600bf Mon Sep 17 00:00:00 2001 From: talyz Date: Thu, 12 Aug 2021 12:32:14 +0200 Subject: [PATCH 11/18] discourse.plugins.discourse-data-explorer: Update (cherry picked from commit 6f2652735817e22c55de3b6e137faf7cdbc3fd2a) --- .../discourse/plugins/discourse-data-explorer/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-data-explorer/default.nix b/pkgs/servers/web-apps/discourse/plugins/discourse-data-explorer/default.nix index 983c8b7fe83..90218759cac 100644 --- a/pkgs/servers/web-apps/discourse/plugins/discourse-data-explorer/default.nix +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-data-explorer/default.nix @@ -5,8 +5,8 @@ mkDiscoursePlugin { src = fetchFromGitHub { owner = "discourse"; repo = "discourse-data-explorer"; - rev = "7a348aaa8b2a6b3a75db72e99a7370a1a6fcb2b8"; - sha256 = "sha256-4X0oor3dIKrQO5IrScQ9+DBr39R7PJJ8dg9UQseV6IU="; + rev = "23287ece952cb45203819e7b470ebc194c58cb13"; + sha256 = "1vc2072r72fkvcfpy6vpn9x4gl9lpjk29pnj8095xs22im8j5in1"; }; meta = with lib; { homepage = "https://github.com/discourse/discourse-data-explorer"; From 639e1d96399d82bec6df28448e61a0e450113d29 Mon Sep 17 00:00:00 2001 From: talyz Date: Thu, 12 Aug 2021 12:33:06 +0200 Subject: [PATCH 12/18] discourse: Remove leftover link to unused plugins directory (cherry picked from commit bb14315d51a1c35304dfd82ff5c1faeaaf2c450c) --- nixos/modules/services/web-apps/discourse.nix | 1 - pkgs/servers/web-apps/discourse/default.nix | 1 - 2 files changed, 2 deletions(-) diff --git a/nixos/modules/services/web-apps/discourse.nix b/nixos/modules/services/web-apps/discourse.nix index 8d5302ba267..050e4ee3d32 100644 --- a/nixos/modules/services/web-apps/discourse.nix +++ b/nixos/modules/services/web-apps/discourse.nix @@ -771,7 +771,6 @@ in "tmp" "assets/javascripts/plugins" "public" - "plugins" "sockets" ]; RuntimeDirectoryMode = 0750; diff --git a/pkgs/servers/web-apps/discourse/default.nix b/pkgs/servers/web-apps/discourse/default.nix index 8f680ac575d..52fbafe6b5a 100644 --- a/pkgs/servers/web-apps/discourse/default.nix +++ b/pkgs/servers/web-apps/discourse/default.nix @@ -273,7 +273,6 @@ let ln -sf /run/discourse/config $out/share/discourse/config ln -sf /run/discourse/assets/javascripts/plugins $out/share/discourse/app/assets/javascripts/plugins ln -sf /run/discourse/public $out/share/discourse/public - ln -sf /run/discourse/plugins $out/share/discourse/plugins ln -sf ${assets} $out/share/discourse/public.dist/assets ${lib.concatMapStringsSep "\n" (p: "ln -sf ${p} $out/share/discourse/plugins/${p.pluginName or ""}") plugins} From 080e4e43fb065704262f1f3f99b885740226f00c Mon Sep 17 00:00:00 2001 From: talyz Date: Thu, 12 Aug 2021 12:34:14 +0200 Subject: [PATCH 13/18] discourse.tests: Test the appropriate discourse package Perform the tests on the package that the `tests` attribute is a child of, i.e. if `discourseAllPlugins.tests` is built, the tests will run with the `discourseAllPlugins` package, not the `discourse` package as previously. (cherry picked from commit 6fd5a40ccaf0b4da1362803a387bf46d381dd66a) --- nixos/tests/discourse.nix | 4 ++-- pkgs/servers/web-apps/discourse/default.nix | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nixos/tests/discourse.nix b/nixos/tests/discourse.nix index 2ed6fb957c2..7dd39085a00 100644 --- a/nixos/tests/discourse.nix +++ b/nixos/tests/discourse.nix @@ -4,7 +4,7 @@ # 3. replying to that message via email. import ./make-test-python.nix ( - { pkgs, lib, ... }: + { pkgs, lib, package ? pkgs.discourse, ... }: let certs = import ./common/acme/server/snakeoil-certs.nix; clientDomain = "client.fake.domain"; @@ -55,7 +55,7 @@ import ./make-test-python.nix ( services.discourse = { enable = true; - inherit admin; + inherit admin package; hostname = discourseDomain; sslCertificate = "${certs.${discourseDomain}.cert}"; sslCertificateKey = "${certs.${discourseDomain}.key}"; diff --git a/pkgs/servers/web-apps/discourse/default.nix b/pkgs/servers/web-apps/discourse/default.nix index 52fbafe6b5a..abe12fe0d8c 100644 --- a/pkgs/servers/web-apps/discourse/default.nix +++ b/pkgs/servers/web-apps/discourse/default.nix @@ -1,4 +1,4 @@ -{ stdenv, makeWrapper, runCommandNoCC, lib, nixosTests, writeShellScript +{ stdenv, pkgs, makeWrapper, runCommandNoCC, lib, writeShellScript , fetchFromGitHub, bundlerEnv, callPackage , ruby, replace, gzip, gnutar, git, cacert, util-linux, gawk @@ -6,7 +6,7 @@ , redis, postgresql, which, brotli, procps, rsync, nodePackages, v8 , plugins ? [] -}: +}@args: let version = "2.7.7"; @@ -292,7 +292,7 @@ let enabledPlugins = plugins; plugins = callPackage ./plugins/all-plugins.nix { inherit mkDiscoursePlugin; }; ruby = rubyEnv.wrappedRuby; - tests = nixosTests.discourse; + tests = import ../../../../nixos/tests/discourse.nix { package = pkgs.discourse.override args; }; }; }; in discourse From af15cbe6b0df1fd6a7942542087349208b2bd0d7 Mon Sep 17 00:00:00 2001 From: talyz Date: Thu, 12 Aug 2021 12:37:33 +0200 Subject: [PATCH 14/18] discourse: Change the path to the auto generated plugin assets Change the path to the auto generated plugin assets, which defaults to the plugin's directory and isn't writable at the time of asset generation. (cherry picked from commit 443b318ee9c614d480a2ecb0120b52806d6fbb3b) --- .../web-apps/discourse/auto_generated_path.patch | 13 +++++++++++++ pkgs/servers/web-apps/discourse/default.nix | 10 ++++++++++ 2 files changed, 23 insertions(+) create mode 100644 pkgs/servers/web-apps/discourse/auto_generated_path.patch diff --git a/pkgs/servers/web-apps/discourse/auto_generated_path.patch b/pkgs/servers/web-apps/discourse/auto_generated_path.patch new file mode 100644 index 00000000000..9dcb1cb5595 --- /dev/null +++ b/pkgs/servers/web-apps/discourse/auto_generated_path.patch @@ -0,0 +1,13 @@ +diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb +index 380a63e987..b2ce7fa982 100644 +--- a/lib/plugin/instance.rb ++++ b/lib/plugin/instance.rb +@@ -403,7 +403,7 @@ class Plugin::Instance + end + + def auto_generated_path +- File.dirname(path) << "/auto_generated" ++ "#{Rails.root}/public/assets/auto_generated_plugin_assets/#{name}" + end + + def after_initialize(&block) diff --git a/pkgs/servers/web-apps/discourse/default.nix b/pkgs/servers/web-apps/discourse/default.nix index abe12fe0d8c..41f0bf91503 100644 --- a/pkgs/servers/web-apps/discourse/default.nix +++ b/pkgs/servers/web-apps/discourse/default.nix @@ -157,6 +157,11 @@ let # Use the Ruby API version in the plugin gem path, to match the # one constructed by bundlerEnv ./plugin_gem_api_version.patch + + # Change the path to the auto generated plugin assets, which + # defaults to the plugin's directory and isn't writable at the + # time of asset generation + ./auto_generated_path.patch ]; # We have to set up an environment that is close enough to @@ -243,6 +248,11 @@ let # Use mv instead of rename, since rename doesn't work across # device boundaries ./use_mv_instead_of_rename.patch + + # Change the path to the auto generated plugin assets, which + # defaults to the plugin's directory and isn't writable at the + # time of asset generation + ./auto_generated_path.patch ]; postPatch = '' From 08fde82d77f70108134a74dff6fbfaf1fe9e88e9 Mon Sep 17 00:00:00 2001 From: talyz Date: Fri, 13 Aug 2021 18:10:05 +0200 Subject: [PATCH 15/18] discourse.plugins.discourse-github: Update (cherry picked from commit 4197b6dd146c395f1caec3b086334a2b0eff623a) --- .../plugins/discourse-github/Gemfile.lock | 10 ++++---- .../plugins/discourse-github/default.nix | 4 ++-- .../plugins/discourse-github/gemset.nix | 24 +++++++++++++------ 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-github/Gemfile.lock b/pkgs/servers/web-apps/discourse/plugins/discourse-github/Gemfile.lock index 0486ea1402b..b6ebd834a53 100644 --- a/pkgs/servers/web-apps/discourse/plugins/discourse-github/Gemfile.lock +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-github/Gemfile.lock @@ -3,7 +3,7 @@ GEM specs: addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) - faraday (1.5.0) + faraday (1.7.0) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -11,6 +11,7 @@ GEM faraday-net_http (~> 1.0) faraday-net_http_persistent (~> 1.1) faraday-patron (~> 1.0) + faraday-rack (~> 1.0) multipart-post (>= 1.2, < 3) ruby2_keywords (>= 0.0.4) faraday-em_http (1.0.0) @@ -18,20 +19,21 @@ GEM faraday-excon (1.1.0) faraday-httpclient (1.0.1) faraday-net_http (1.0.1) - faraday-net_http_persistent (1.1.0) + faraday-net_http_persistent (1.2.0) faraday-patron (1.0.0) + faraday-rack (1.0.0) multipart-post (2.1.1) octokit (4.21.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) public_suffix (4.0.6) - ruby2_keywords (0.0.4) + ruby2_keywords (0.0.5) sawyer (0.8.2) addressable (>= 2.3.5) faraday (> 0.8, < 2.0) PLATFORMS - x86_64-linux + ruby DEPENDENCIES octokit (= 4.21.0) diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-github/default.nix b/pkgs/servers/web-apps/discourse/plugins/discourse-github/default.nix index bb6d16bfe46..63488de18ff 100644 --- a/pkgs/servers/web-apps/discourse/plugins/discourse-github/default.nix +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-github/default.nix @@ -6,8 +6,8 @@ mkDiscoursePlugin { src = fetchFromGitHub { owner = "discourse"; repo = "discourse-github"; - rev = "154fd5ea597640c2259ce489b4ce75b48ac1973c"; - sha256 = "0wb5p219z42rc035rnh2iwrbsj000nxa9shbmc325rzcg6xlhdhw"; + rev = "b6ad8e39a13e2ad5c6943ea697ca23f2c5f9fec1"; + sha256 = "0vxwp4kbf44clcqilb8ni0ykk4jrgiv4rbd05pgfvndcp3izm2i6"; }; meta = with lib; { homepage = "https://github.com/discourse/discourse-github"; diff --git a/pkgs/servers/web-apps/discourse/plugins/discourse-github/gemset.nix b/pkgs/servers/web-apps/discourse/plugins/discourse-github/gemset.nix index ae20ec89521..90009a3beb8 100644 --- a/pkgs/servers/web-apps/discourse/plugins/discourse-github/gemset.nix +++ b/pkgs/servers/web-apps/discourse/plugins/discourse-github/gemset.nix @@ -11,15 +11,15 @@ version = "2.8.0"; }; faraday = { - dependencies = ["faraday-em_http" "faraday-em_synchrony" "faraday-excon" "faraday-httpclient" "faraday-net_http" "faraday-net_http_persistent" "faraday-patron" "multipart-post" "ruby2_keywords"]; + dependencies = ["faraday-em_http" "faraday-em_synchrony" "faraday-excon" "faraday-httpclient" "faraday-net_http" "faraday-net_http_persistent" "faraday-patron" "faraday-rack" "multipart-post" "ruby2_keywords"]; groups = ["default"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0gwbii45plm9bljk22bwzhzxrc5xid8qx24f54vrm74q3zaz00ah"; + sha256 = "0r6ik2yvsbx6jj30vck32da2bbvj4m0gf4jhp09vr75i1d6jzfvb"; type = "gem"; }; - version = "1.5.0"; + version = "1.7.0"; }; faraday-em_http = { groups = ["default"]; @@ -76,10 +76,10 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0l2c835wl7gv34xp49fhd1bl4czkpw2g3ahqsak2251iqv5589ka"; + sha256 = "0dc36ih95qw3rlccffcb0vgxjhmipsvxhn6cw71l7ffs0f7vq30b"; type = "gem"; }; - version = "1.1.0"; + version = "1.2.0"; }; faraday-patron = { groups = ["default"]; @@ -91,6 +91,16 @@ }; version = "1.0.0"; }; + faraday-rack = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1h184g4vqql5jv9s9im6igy00jp6mrah2h14py6mpf9bkabfqq7g"; + type = "gem"; + }; + version = "1.0.0"; + }; multipart-post = { groups = ["default"]; platforms = []; @@ -127,10 +137,10 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "15wfcqxyfgka05v2a7kpg64x57gl1y4xzvnc9lh60bqx5sf1iqrs"; + sha256 = "1vz322p8n39hz3b4a9gkmz9y7a5jaz41zrm2ywf31dvkqm03glgz"; type = "gem"; }; - version = "0.0.4"; + version = "0.0.5"; }; sawyer = { dependencies = ["addressable" "faraday"]; From fd169abf9bb666d3f27434ace9c6038174524c48 Mon Sep 17 00:00:00 2001 From: talyz Date: Fri, 13 Aug 2021 18:42:56 +0200 Subject: [PATCH 16/18] discourse.plugins: Make the updater able to package plugins Let the update.py script handle the initial, repetitive task of packaging new plugins. With this in place, the plugin only needs to be added to the list in `update-plugins` and most of the work will be done automatically when the script is run. Metadata still needs to be filled in manually and some packages may of course require additional work/patching. (cherry picked from commit f8096460bd15d4f13a01cfddf0a30798921fdb42) --- nixos/modules/services/web-apps/discourse.xml | 13 ++++- pkgs/servers/web-apps/discourse/update.py | 55 ++++++++++++++++++- 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/web-apps/discourse.xml b/nixos/modules/services/web-apps/discourse.xml index 1d6866e7b35..184c9c6363e 100644 --- a/nixos/modules/services/web-apps/discourse.xml +++ b/nixos/modules/services/web-apps/discourse.xml @@ -284,11 +284,22 @@ services.discourse = { Ruby dependencies are listed in its plugin.rb file as function calls to gem. To construct the corresponding - Gemfile, run bundle + Gemfile manually, run bundle init, then add the gem lines to it verbatim. + + Much of the packaging can be done automatically by the + nixpkgs/pkgs/servers/web-apps/discourse/update.py + script - just add the plugin to the plugins + list in the update_plugins function and run + the script: + +./update.py update-plugins +. + + Some plugins provide site diff --git a/pkgs/servers/web-apps/discourse/update.py b/pkgs/servers/web-apps/discourse/update.py index 4832e8638ea..c77cb06e120 100755 --- a/pkgs/servers/web-apps/discourse/update.py +++ b/pkgs/servers/web-apps/discourse/update.py @@ -12,6 +12,7 @@ import os import stat import json import requests +import textwrap from distutils.version import LooseVersion from pathlib import Path from typing import Iterable @@ -77,7 +78,11 @@ def _call_nix_update(pkg, version): def _nix_eval(expr: str): nixpkgs_path = Path(__file__).parent / '../../../../' - return json.loads(subprocess.check_output(['nix', 'eval', '--json', f'(with import {nixpkgs_path} {{}}; {expr})'], text=True)) + try: + output = subprocess.check_output(['nix', 'eval', '--json', f'(with import {nixpkgs_path} {{}}; {expr})'], text=True) + except subprocess.CalledProcessError: + return None + return json.loads(output) def _get_current_package_version(pkg: str): @@ -206,13 +211,59 @@ def update_plugins(): repo_name = plugin.get('repo_name') or name repo = DiscourseRepo(owner=owner, repo=repo_name) + + filename = _nix_eval(f'builtins.unsafeGetAttrPos "src" discourse.plugins.{name}') + if filename is None: + filename = Path(__file__).parent / 'plugins' / name / 'default.nix' + filename.parent.mkdir() + + has_ruby_deps = False + for line in repo.get_file('plugin.rb', repo.latest_commit_sha).splitlines(): + if 'gem ' in line: + has_ruby_deps = True + break + + with open(filename, 'w') as f: + f.write(textwrap.dedent(f""" + {{ lib, mkDiscoursePlugin, fetchFromGitHub }}: + + mkDiscoursePlugin {{ + name = "{name}";"""[1:] + (""" + bundlerEnvArgs.gemdir = ./.;""" if has_ruby_deps else "") + f""" + src = {fetcher} {{ + owner = "{owner}"; + repo = "{repo_name}"; + rev = "replace-with-git-rev"; + sha256 = "replace-with-sha256"; + }}; + meta = with lib; {{ + homepage = ""; + maintainers = with maintainers; [ ]; + license = licenses.mit; # change to the correct license! + description = ""; + }}; + }}""")) + + all_plugins_filename = Path(__file__).parent / 'plugins' / 'all-plugins.nix' + with open(all_plugins_filename, 'r+') as f: + content = f.read() + pos = -1 + while content[pos] != '}': + pos -= 1 + content = content[:pos] + f' {name} = callPackage ./{name} {{}};' + os.linesep + content[pos:] + f.seek(0) + f.write(content) + f.truncate() + + else: + filename = filename['file'] + prev_commit_sha = _nix_eval(f'discourse.plugins.{name}.src.rev') if prev_commit_sha == repo.latest_commit_sha: click.echo(f'Plugin {name} is already at the latest revision') continue - filename = _nix_eval(f'builtins.unsafeGetAttrPos "src" discourse.plugins.{name}')['file'] prev_hash = _nix_eval(f'discourse.plugins.{name}.src.outputHash') new_hash = subprocess.check_output([ 'nix-universal-prefetch', fetcher, From ba5434c984b3c0e1b350be6d2476c067fb51d023 Mon Sep 17 00:00:00 2001 From: talyz Date: Fri, 13 Aug 2021 18:53:18 +0200 Subject: [PATCH 17/18] discourse.mkDiscoursePlugin: Handle repos with `gems` directories Some plugin repos already have a `gems` directory. This lets the packager choose whether it should be kept and the nix packaged ruby gems should be copied into it or if it should be removed in favor of our ruby gems. (cherry picked from commit 04e6b03fa91603c7f1961cfcdcf5880c91fe6b05) --- pkgs/servers/web-apps/discourse/default.nix | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pkgs/servers/web-apps/discourse/default.nix b/pkgs/servers/web-apps/discourse/default.nix index 41f0bf91503..59e3d4b18e9 100644 --- a/pkgs/servers/web-apps/discourse/default.nix +++ b/pkgs/servers/web-apps/discourse/default.nix @@ -55,6 +55,7 @@ let , version ? null , meta ? null , bundlerEnvArgs ? {} + , preserveGemsDir ? false , src , ... }@args: @@ -71,11 +72,20 @@ let runHook preInstall mkdir -p $out cp -r * $out/ - '' + lib.optionalString (bundlerEnvArgs != {}) '' - ln -sf ${rubyEnv}/lib/ruby/gems $out/gems - '' + '' + '' + lib.optionalString (bundlerEnvArgs != {}) ( + if preserveGemsDir then '' + cp -r ${rubyEnv}/lib/ruby/gems/* $out/gems/ + '' + else '' + if [[ -e $out/gems ]]; then + echo "Warning: The repo contains a 'gems' directory which will be removed!" + echo " If you need to preserve it, set 'preserveGemsDir = true'." + rm -r $out/gems + fi + ln -sf ${rubyEnv}/lib/ruby/gems $out/gems + '' + '' runHook postInstall - ''; + ''); }); rake = runCommandNoCC "discourse-rake" { From 18902d1e12aef35b0f7e7e0c3831e3c0e4827d45 Mon Sep 17 00:00:00 2001 From: talyz Date: Fri, 13 Aug 2021 19:00:23 +0200 Subject: [PATCH 18/18] discourse: update.py: Remove native platforms in plugin lock files.. ...and add ruby. (cherry picked from commit 12ff4b79e48d9c4aa5660d2ec7ce52a21806d8e4) --- pkgs/servers/web-apps/discourse/update.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pkgs/servers/web-apps/discourse/update.py b/pkgs/servers/web-apps/discourse/update.py index c77cb06e120..127088dafbf 100755 --- a/pkgs/servers/web-apps/discourse/update.py +++ b/pkgs/servers/web-apps/discourse/update.py @@ -116,6 +116,18 @@ def _diff_file(filepath: str, old_version: str, new_version: str): return +def _remove_platforms(rubyenv_dir: Path): + for platform in ['arm64-darwin-20', 'x86_64-darwin-18', + 'x86_64-darwin-19', 'x86_64-darwin-20', + 'x86_64-linux']: + with open(rubyenv_dir / 'Gemfile.lock', 'r') as f: + for line in f: + if platform in line: + subprocess.check_output( + ['bundle', 'lock', '--remove-platform', platform], cwd=rubyenv_dir) + break + + @click_log.simple_verbosity_option(logger) @@ -178,10 +190,7 @@ def update(rev): f.write(repo.get_file(fn, rev)) subprocess.check_output(['bundle', 'lock'], cwd=rubyenv_dir) - for platform in ['arm64-darwin-20', 'x86_64-darwin-18', - 'x86_64-darwin-19', 'x86_64-darwin-20', - 'x86_64-linux']: - subprocess.check_output(['bundle', 'lock', '--remove-platform', platform], cwd=rubyenv_dir) + _remove_platforms(rubyenv_dir) subprocess.check_output(['bundix'], cwd=rubyenv_dir) _call_nix_update('discourse', repo.rev2version(rev)) @@ -299,7 +308,9 @@ def update_plugins(): with open(gemfile, 'a') as f: f.write(gemfile_text) + subprocess.check_output(['bundle', 'lock', '--add-platform', 'ruby'], cwd=rubyenv_dir) subprocess.check_output(['bundle', 'lock', '--update'], cwd=rubyenv_dir) + _remove_platforms(rubyenv_dir) subprocess.check_output(['bundix'], cwd=rubyenv_dir)