From ee429344a5d6e54dd77c73ccc6eae11903a7c6ff Mon Sep 17 00:00:00 2001 From: Ivan Trubach Date: Wed, 22 Nov 2023 11:53:43 +0300 Subject: [PATCH 1/2] pghero: init at 3.5.0 --- pkgs/by-name/pg/pghero/Gemfile | 14 + pkgs/by-name/pg/pghero/Gemfile.lock | 280 ++++++++ pkgs/by-name/pg/pghero/gemset.nix | 1034 +++++++++++++++++++++++++++ pkgs/by-name/pg/pghero/package.nix | 70 ++ pkgs/by-name/pg/pghero/update.nix | 59 ++ 5 files changed, 1457 insertions(+) create mode 100644 pkgs/by-name/pg/pghero/Gemfile create mode 100644 pkgs/by-name/pg/pghero/Gemfile.lock create mode 100644 pkgs/by-name/pg/pghero/gemset.nix create mode 100644 pkgs/by-name/pg/pghero/package.nix create mode 100644 pkgs/by-name/pg/pghero/update.nix diff --git a/pkgs/by-name/pg/pghero/Gemfile b/pkgs/by-name/pg/pghero/Gemfile new file mode 100644 index 000000000000..ab0039625a89 --- /dev/null +++ b/pkgs/by-name/pg/pghero/Gemfile @@ -0,0 +1,14 @@ +source "https://rubygems.org" + +gem "rails", "~> 7.0.0" +gem "propshaft" +gem "puma" +gem "pg" +gem "activerecord-nulldb-adapter", require: false + +# See also https://github.com/ankane/pghero/blob/v3.3.4/guides/Rails.md +gem "pghero" +gem "pg_query" +gem "aws-sdk-cloudwatch" +gem "google-apis-monitoring_v3" +gem "azure_mgmt_monitor" diff --git a/pkgs/by-name/pg/pghero/Gemfile.lock b/pkgs/by-name/pg/pghero/Gemfile.lock new file mode 100644 index 000000000000..df92af192636 --- /dev/null +++ b/pkgs/by-name/pg/pghero/Gemfile.lock @@ -0,0 +1,280 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.0.8.3) + actionpack (= 7.0.8.3) + activesupport (= 7.0.8.3) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (7.0.8.3) + actionpack (= 7.0.8.3) + activejob (= 7.0.8.3) + activerecord (= 7.0.8.3) + activestorage (= 7.0.8.3) + activesupport (= 7.0.8.3) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.0.8.3) + actionpack (= 7.0.8.3) + actionview (= 7.0.8.3) + activejob (= 7.0.8.3) + activesupport (= 7.0.8.3) + mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.0) + actionpack (7.0.8.3) + actionview (= 7.0.8.3) + activesupport (= 7.0.8.3) + rack (~> 2.0, >= 2.2.4) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (7.0.8.3) + actionpack (= 7.0.8.3) + activerecord (= 7.0.8.3) + activestorage (= 7.0.8.3) + activesupport (= 7.0.8.3) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.0.8.3) + activesupport (= 7.0.8.3) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (7.0.8.3) + activesupport (= 7.0.8.3) + globalid (>= 0.3.6) + activemodel (7.0.8.3) + activesupport (= 7.0.8.3) + activerecord (7.0.8.3) + activemodel (= 7.0.8.3) + activesupport (= 7.0.8.3) + activerecord-nulldb-adapter (1.0.1) + activerecord (>= 5.2.0, < 7.2) + activestorage (7.0.8.3) + actionpack (= 7.0.8.3) + activejob (= 7.0.8.3) + activerecord (= 7.0.8.3) + activesupport (= 7.0.8.3) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (7.0.8.3) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + aws-eventstream (1.3.0) + aws-partitions (1.935.0) + aws-sdk-cloudwatch (1.91.0) + aws-sdk-core (~> 3, >= 3.193.0) + aws-sigv4 (~> 1.1) + aws-sdk-core (3.196.1) + aws-eventstream (~> 1, >= 1.3.0) + aws-partitions (~> 1, >= 1.651.0) + aws-sigv4 (~> 1.8) + jmespath (~> 1, >= 1.6.1) + aws-sigv4 (1.8.0) + aws-eventstream (~> 1, >= 1.0.2) + azure_mgmt_monitor (0.19.0) + ms_rest_azure (~> 0.12.0) + base64 (0.2.0) + bigdecimal (3.1.8) + builder (3.2.4) + concurrent-ruby (1.2.3) + crass (1.0.6) + date (3.3.4) + declarative (0.0.20) + domain_name (0.6.20240107) + erubi (1.12.0) + faraday (1.10.3) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + globalid (1.2.1) + activesupport (>= 6.1) + google-apis-core (0.15.0) + addressable (~> 2.5, >= 2.5.1) + googleauth (~> 1.9) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + google-apis-monitoring_v3 (0.62.0) + google-apis-core (>= 0.15.0, < 2.a) + google-cloud-env (2.1.1) + faraday (>= 1.0, < 3.a) + google-protobuf (4.27.0) + bigdecimal + rake (>= 13) + googleauth (1.11.0) + faraday (>= 1.0, < 3.a) + google-cloud-env (~> 2.1) + jwt (>= 1.4, < 3.0) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + http-cookie (1.0.5) + domain_name (~> 0.5) + httpclient (2.8.3) + i18n (1.14.5) + concurrent-ruby (~> 1.0) + jmespath (1.6.2) + jwt (2.8.1) + base64 + loofah (2.22.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + mini_portile2 (2.8.6) + minitest (5.23.1) + ms_rest (0.7.6) + concurrent-ruby (~> 1.0) + faraday (>= 0.9, < 2.0.0) + timeliness (~> 0.3.10) + ms_rest_azure (0.12.0) + concurrent-ruby (~> 1.0) + faraday (>= 0.9, < 2.0.0) + faraday-cookie_jar (~> 0.0.6) + ms_rest (~> 0.7.6) + multi_json (1.15.0) + multipart-post (2.4.1) + net-imap (0.4.11) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.3) + nokogiri (1.16.5) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) + os (1.1.4) + pg (1.5.6) + pg_query (5.1.0) + google-protobuf (>= 3.22.3) + pghero (3.5.0) + activerecord (>= 6) + propshaft (0.9.0) + actionpack (>= 7.0.0) + activesupport (>= 7.0.0) + rack + railties (>= 7.0.0) + public_suffix (5.0.5) + puma (6.4.2) + nio4r (~> 2.0) + racc (1.8.0) + rack (2.2.9) + rack-test (2.1.0) + rack (>= 1.3) + rails (7.0.8.3) + actioncable (= 7.0.8.3) + actionmailbox (= 7.0.8.3) + actionmailer (= 7.0.8.3) + actionpack (= 7.0.8.3) + actiontext (= 7.0.8.3) + actionview (= 7.0.8.3) + activejob (= 7.0.8.3) + activemodel (= 7.0.8.3) + activerecord (= 7.0.8.3) + activestorage (= 7.0.8.3) + activesupport (= 7.0.8.3) + bundler (>= 1.15.0) + railties (= 7.0.8.3) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (7.0.8.3) + actionpack (= 7.0.8.3) + activesupport (= 7.0.8.3) + method_source + rake (>= 12.2) + thor (~> 1.0) + zeitwerk (~> 2.5) + rake (13.2.1) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.2.8) + strscan (>= 3.0.9) + ruby2_keywords (0.0.5) + signet (0.19.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + strscan (3.1.0) + thor (1.3.1) + timeliness (0.3.10) + timeout (0.4.1) + trailblazer-option (0.1.2) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + uber (0.1.0) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.15) + +PLATFORMS + ruby + +DEPENDENCIES + activerecord-nulldb-adapter + aws-sdk-cloudwatch + azure_mgmt_monitor + google-apis-monitoring_v3 + pg + pg_query + pghero + propshaft + puma + rails (~> 7.0.0) + +BUNDLED WITH + 2.5.9 diff --git a/pkgs/by-name/pg/pghero/gemset.nix b/pkgs/by-name/pg/pghero/gemset.nix new file mode 100644 index 000000000000..1988239ea432 --- /dev/null +++ b/pkgs/by-name/pg/pghero/gemset.nix @@ -0,0 +1,1034 @@ +{ + actioncable = { + dependencies = ["actionpack" "activesupport" "nio4r" "websocket-driver"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1d5g5h9r2a026fg3b75ffkfd5xkc7djild9hf7gb3v78ri20mdxy"; + type = "gem"; + }; + version = "7.0.8.3"; + }; + actionmailbox = { + dependencies = ["actionpack" "activejob" "activerecord" "activestorage" "activesupport" "mail" "net-imap" "net-pop" "net-smtp"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1drdgk8795mm2wlb9g50jixd2q79vr9fkrxvqcanbmqa16y2v7k7"; + type = "gem"; + }; + version = "7.0.8.3"; + }; + actionmailer = { + dependencies = ["actionpack" "actionview" "activejob" "activesupport" "mail" "net-imap" "net-pop" "net-smtp" "rails-dom-testing"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1klwlyfnnznwpcphg6z2n8z9508szr33xk7x3hv4ycdqcirgnfr5"; + type = "gem"; + }; + version = "7.0.8.3"; + }; + actionpack = { + dependencies = ["actionview" "activesupport" "rack" "rack-test" "rails-dom-testing" "rails-html-sanitizer"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "11c5pm65m46wlqd25glmwpkji1jn1v2n918jmklxp4w9rr43dzi6"; + type = "gem"; + }; + version = "7.0.8.3"; + }; + actiontext = { + dependencies = ["actionpack" "activerecord" "activestorage" "activesupport" "globalid" "nokogiri"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1nxycm7wpxyf05hqd1bgy98jdyi0wynlwzs7p3km8gwpdmgfw1ad"; + type = "gem"; + }; + version = "7.0.8.3"; + }; + actionview = { + dependencies = ["activesupport" "builder" "erubi" "rails-dom-testing" "rails-html-sanitizer"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0p0w1rl3f5k7m39j9gnyw5wqz6ym18bhcacisqq4zng2k6jf4893"; + type = "gem"; + }; + version = "7.0.8.3"; + }; + activejob = { + dependencies = ["activesupport" "globalid"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0njgqssvh3gzk0hhr04y0f783i7b44draadhjv2jsd56ssx5h8qa"; + type = "gem"; + }; + version = "7.0.8.3"; + }; + activemodel = { + dependencies = ["activesupport"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0y8w73rdd7x1m1gwswjhpqfbjr95hh7hcnkjqk1wz8x9gjk9njb6"; + type = "gem"; + }; + version = "7.0.8.3"; + }; + activerecord = { + dependencies = ["activemodel" "activesupport"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "03pqj57md528dgwwplr234hq628allla71i1pxys2inbpp7s7vn8"; + type = "gem"; + }; + version = "7.0.8.3"; + }; + activerecord-nulldb-adapter = { + dependencies = ["activerecord"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1552py7zlamd5gy2dbkzjixanl9k07y6jqqrr4ic6n52apwd0ijy"; + type = "gem"; + }; + version = "1.0.1"; + }; + activestorage = { + dependencies = ["actionpack" "activejob" "activerecord" "activesupport" "marcel" "mini_mime"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1pkb6ssxl8b9w8pczd562qw0n78fvgjc3xb5yjpfips33a7zqd9j"; + type = "gem"; + }; + version = "7.0.8.3"; + }; + activesupport = { + dependencies = ["concurrent-ruby" "i18n" "minitest" "tzinfo"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1ybapgiiysxgcjyzifn34ksbwjdjzslbvbcd7v83wiry1qmiyg93"; + type = "gem"; + }; + version = "7.0.8.3"; + }; + addressable = { + dependencies = ["public_suffix"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0irbdwkkjwzajq1ip6ba46q49sxnrl2cw7ddkdhsfhb6aprnm3vr"; + type = "gem"; + }; + version = "2.8.6"; + }; + aws-eventstream = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0gvdg4yx4p9av2glmp7vsxhs0n8fj1ga9kq2xdb8f95j7b04qhzi"; + type = "gem"; + }; + version = "1.3.0"; + }; + aws-partitions = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "10yhixzr5ndxswgis8z23cqas98m6idd2zprg7ms4sg2iixnh6sz"; + type = "gem"; + }; + version = "1.935.0"; + }; + aws-sdk-cloudwatch = { + dependencies = ["aws-sdk-core" "aws-sigv4"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0iw1754r8rizshv04rj9fsm56ipnipfqxb349mx4cy195bq5k72n"; + type = "gem"; + }; + version = "1.91.0"; + }; + aws-sdk-core = { + dependencies = ["aws-eventstream" "aws-partitions" "aws-sigv4" "jmespath"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0f44kp3g9g8v60f7xw769r734b7w6n774jj2njn42444ip3zwsz3"; + type = "gem"; + }; + version = "3.196.1"; + }; + aws-sigv4 = { + dependencies = ["aws-eventstream"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1g3w27wzjy4si6kp49w10as6ml6g6zl3xrfqs5ikpfciidv9kpc4"; + type = "gem"; + }; + version = "1.8.0"; + }; + azure_mgmt_monitor = { + dependencies = ["ms_rest_azure"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "13yqhcdqv4lr6bf3ylh2p1k9x4qg9qlr05y9fv7fi8yj5rqrbjhx"; + type = "gem"; + }; + version = "0.19.0"; + }; + base64 = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "01qml0yilb9basf7is2614skjp8384h2pycfx86cr8023arfj98g"; + type = "gem"; + }; + version = "0.2.0"; + }; + bigdecimal = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1gi7zqgmqwi5lizggs1jhc3zlwaqayy9rx2ah80sxy24bbnng558"; + type = "gem"; + }; + version = "3.1.8"; + }; + builder = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "045wzckxpwcqzrjr353cxnyaxgf0qg22jh00dcx7z38cys5g1jlr"; + type = "gem"; + }; + version = "3.2.4"; + }; + concurrent-ruby = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1qh1b14jwbbj242klkyz5fc7npd4j0mvndz62gajhvl1l3wd7zc2"; + type = "gem"; + }; + version = "1.2.3"; + }; + crass = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0pfl5c0pyqaparxaqxi6s4gfl21bdldwiawrc0aknyvflli60lfw"; + type = "gem"; + }; + version = "1.0.6"; + }; + date = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "149jknsq999gnhy865n33fkk22s0r447k76x9pmcnnwldfv2q7wp"; + type = "gem"; + }; + version = "3.3.4"; + }; + declarative = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1yczgnqrbls7shrg63y88g7wand2yp9h6sf56c9bdcksn5nds8c0"; + type = "gem"; + }; + version = "0.0.20"; + }; + domain_name = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0cyr2xm576gqhqicsyqnhanni47408w2pgvrfi8pd13h2li3nsaz"; + type = "gem"; + }; + version = "0.6.20240107"; + }; + erubi = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "08s75vs9cxlc4r1q2bjg4br8g9wc5lc5x5vl0vv4zq5ivxsdpgi7"; + type = "gem"; + }; + version = "1.12.0"; + }; + faraday = { + dependencies = ["faraday-em_http" "faraday-em_synchrony" "faraday-excon" "faraday-httpclient" "faraday-multipart" "faraday-net_http" "faraday-net_http_persistent" "faraday-patron" "faraday-rack" "faraday-retry" "ruby2_keywords"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1c760q0ks4vj4wmaa7nh1dgvgqiwaw0mjr7v8cymy7i3ffgjxx90"; + type = "gem"; + }; + version = "1.10.3"; + }; + faraday-cookie_jar = { + dependencies = ["faraday" "http-cookie"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "00hligx26w9wdnpgsrf0qdnqld4rdccy8ym6027h5m735mpvxjzk"; + type = "gem"; + }; + version = "0.0.7"; + }; + faraday-em_http = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "12cnqpbak4vhikrh2cdn94assh3yxza8rq2p9w2j34bqg5q4qgbs"; + type = "gem"; + }; + version = "1.0.0"; + }; + faraday-em_synchrony = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1vgrbhkp83sngv6k4mii9f2s9v5lmp693hylfxp2ssfc60fas3a6"; + type = "gem"; + }; + version = "1.0.0"; + }; + faraday-excon = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0h09wkb0k0bhm6dqsd47ac601qiaah8qdzjh8gvxfd376x1chmdh"; + type = "gem"; + }; + version = "1.1.0"; + }; + faraday-httpclient = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0fyk0jd3ks7fdn8nv3spnwjpzx2lmxmg2gh4inz3by1zjzqg33sc"; + type = "gem"; + }; + version = "1.0.1"; + }; + faraday-multipart = { + dependencies = ["multipart-post"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "09871c4hd7s5ws1wl4gs7js1k2wlby6v947m2bbzg43pnld044lh"; + type = "gem"; + }; + version = "1.0.4"; + }; + faraday-net_http = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1fi8sda5hc54v1w3mqfl5yz09nhx35kglyx72w7b8xxvdr0cwi9j"; + type = "gem"; + }; + version = "1.0.1"; + }; + faraday-net_http_persistent = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0dc36ih95qw3rlccffcb0vgxjhmipsvxhn6cw71l7ffs0f7vq30b"; + type = "gem"; + }; + version = "1.2.0"; + }; + faraday-patron = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "19wgsgfq0xkski1g7m96snv39la3zxz6x7nbdgiwhg5v82rxfb6w"; + type = "gem"; + }; + version = "1.0.0"; + }; + faraday-rack = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1h184g4vqql5jv9s9im6igy00jp6mrah2h14py6mpf9bkabfqq7g"; + type = "gem"; + }; + version = "1.0.0"; + }; + faraday-retry = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "153i967yrwnswqgvnnajgwp981k9p50ys1h80yz3q94rygs59ldd"; + type = "gem"; + }; + version = "1.0.3"; + }; + globalid = { + dependencies = ["activesupport"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1sbw6b66r7cwdx3jhs46s4lr991969hvigkjpbdl7y3i31qpdgvh"; + type = "gem"; + }; + version = "1.2.1"; + }; + google-apis-core = { + dependencies = ["addressable" "googleauth" "httpclient" "mini_mime" "representable" "retriable" "rexml"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1r56f3h85979q960fvc8iskc6cd0adpqbclqhqzzpcf6d28fx5cw"; + type = "gem"; + }; + version = "0.15.0"; + }; + google-apis-monitoring_v3 = { + dependencies = ["google-apis-core"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0sqd07zpy99m9x69y23j0pyd17y2bvlx2hxd5jcbi5z4hsgnmb59"; + type = "gem"; + }; + version = "0.62.0"; + }; + google-cloud-env = { + dependencies = ["faraday"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "16b9yjbrzal1cjkdbn29fl06ikjn1dpg1vdsjak1xvhpsp3vhjyg"; + type = "gem"; + }; + version = "2.1.1"; + }; + google-protobuf = { + dependencies = ["bigdecimal" "rake"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "13fqdhs2asr2vaqhbmh504zf2khacilqyfwi8qrilwn4md3r6rsy"; + type = "gem"; + }; + version = "4.27.0"; + }; + googleauth = { + dependencies = ["faraday" "google-cloud-env" "jwt" "multi_json" "os" "signet"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "15knmk2fcyqxdpppc3wb5lc6xapbx5hax4lma0iclc2p55aa2kkl"; + type = "gem"; + }; + version = "1.11.0"; + }; + http-cookie = { + dependencies = ["domain_name"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "13rilvlv8kwbzqfb644qp6hrbsj82cbqmnzcvqip1p6vqx36sxbk"; + type = "gem"; + }; + version = "1.0.5"; + }; + httpclient = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "19mxmvghp7ki3klsxwrlwr431li7hm1lczhhj8z4qihl2acy8l99"; + type = "gem"; + }; + version = "2.8.3"; + }; + i18n = { + dependencies = ["concurrent-ruby"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1ffix518y7976qih9k1lgnc17i3v6yrlh0a3mckpxdb4wc2vrp16"; + type = "gem"; + }; + version = "1.14.5"; + }; + jmespath = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1cdw9vw2qly7q7r41s7phnac264rbsdqgj4l0h4nqgbjb157g393"; + type = "gem"; + }; + version = "1.6.2"; + }; + jwt = { + dependencies = ["base64"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "02m3vza49pb9dirwpn8vmzbcypi3fc6l3a9dh253jwm1121g7ajb"; + type = "gem"; + }; + version = "2.8.1"; + }; + loofah = { + dependencies = ["crass" "nokogiri"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1zkjqf37v2d7s11176cb35cl83wls5gm3adnfkn2zcc61h3nxmqh"; + type = "gem"; + }; + version = "2.22.0"; + }; + mail = { + dependencies = ["mini_mime" "net-imap" "net-pop" "net-smtp"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1bf9pysw1jfgynv692hhaycfxa8ckay1gjw5hz3madrbrynryfzc"; + type = "gem"; + }; + version = "2.8.1"; + }; + marcel = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "190n2mk8m1l708kr88fh6mip9sdsh339d2s6sgrik3sbnvz4jmhd"; + type = "gem"; + }; + version = "1.0.4"; + }; + method_source = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1igmc3sq9ay90f8xjvfnswd1dybj1s3fi0dwd53inwsvqk4h24qq"; + type = "gem"; + }; + version = "1.1.0"; + }; + mini_mime = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1vycif7pjzkr29mfk4dlqv3disc5dn0va04lkwajlpr1wkibg0c6"; + type = "gem"; + }; + version = "1.1.5"; + }; + mini_portile2 = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "149r94xi6b3jbp6bv72f8383b95ndn0p5sxnq11gs1j9jadv0ajf"; + type = "gem"; + }; + version = "2.8.6"; + }; + minitest = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1gkslxvkhh44s21rbjvka3zsvfxxrf5pcl6f75rv2vyrzzbgis7i"; + type = "gem"; + }; + version = "5.23.1"; + }; + ms_rest = { + dependencies = ["concurrent-ruby" "faraday" "timeliness"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1jiha1bda5knpjqjymwik6i41n69gb0phcrgvmgc5icl4mcisai7"; + type = "gem"; + }; + version = "0.7.6"; + }; + ms_rest_azure = { + dependencies = ["concurrent-ruby" "faraday" "faraday-cookie_jar" "ms_rest"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "06i37b84r2q206kfm5vsi9s1qiiy09091vhvc5pzb7320h0hc1ih"; + type = "gem"; + }; + version = "0.12.0"; + }; + multi_json = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0pb1g1y3dsiahavspyzkdy39j4q377009f6ix0bh1ag4nqw43l0z"; + type = "gem"; + }; + version = "1.15.0"; + }; + multipart-post = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1a5lrlvmg2kb2dhw3lxcsv6x276bwgsxpnka1752082miqxd0wlq"; + type = "gem"; + }; + version = "2.4.1"; + }; + net-imap = { + dependencies = ["date" "net-protocol"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1y0pzapcasfjayk4nydy04hnx11xmsv8jl8myizxhbpkdmrl10dc"; + type = "gem"; + }; + version = "0.4.11"; + }; + net-pop = { + dependencies = ["net-protocol"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1wyz41jd4zpjn0v1xsf9j778qx1vfrl24yc20cpmph8k42c4x2w4"; + type = "gem"; + }; + version = "0.1.2"; + }; + net-protocol = { + dependencies = ["timeout"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1a32l4x73hz200cm587bc29q8q9az278syw3x6fkc9d1lv5y0wxa"; + type = "gem"; + }; + version = "0.2.2"; + }; + net-smtp = { + dependencies = ["net-protocol"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0amlhz8fhnjfmsiqcjajip57ici2xhw089x7zqyhpk51drg43h2z"; + type = "gem"; + }; + version = "0.5.0"; + }; + nio4r = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "017nbw87dpr4wyk81cgj8kxkxqgsgblrkxnmmadc77cg9gflrfal"; + type = "gem"; + }; + version = "2.7.3"; + }; + nokogiri = { + dependencies = ["mini_portile2" "racc"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1lla2macphrlbzkirk0nwwwhcijrfymyfjjw1als0kwqd0n1cdpc"; + type = "gem"; + }; + version = "1.16.5"; + }; + os = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0gwd20smyhxbm687vdikfh1gpi96h8qb1x28s2pdcysf6dm6v0ap"; + type = "gem"; + }; + version = "1.1.4"; + }; + pg = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "071b55bhsz7mivlnp2kv0a11msnl7xg5awvk8mlflpl270javhsb"; + type = "gem"; + }; + version = "1.5.6"; + }; + pg_query = { + dependencies = ["google-protobuf"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0p8ljf694qvrf5875ljg6kp7gvmndy8490kasjzcq22ghryg9xxp"; + type = "gem"; + }; + version = "5.1.0"; + }; + pghero = { + dependencies = ["activerecord"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0shy6p0bc2z5l1mj6wqc6kxvp0ka3g0i1lhdgl0miqvk6qw9sibv"; + type = "gem"; + }; + version = "3.5.0"; + }; + propshaft = { + dependencies = ["actionpack" "activesupport" "rack" "railties"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "14b06ilc0cadr0jz5aih56yxgnd0j36qp9a4x16py55id1ijw7gy"; + type = "gem"; + }; + version = "0.9.0"; + }; + public_suffix = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "14y4vzjwf5gp0mqgs880kis0k7n2biq8i6ci6q2n315kichl1hvj"; + type = "gem"; + }; + version = "5.0.5"; + }; + puma = { + dependencies = ["nio4r"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0i2vaww6qcazj0ywva1plmjnj6rk23b01szswc5jhcq7s2cikd1y"; + type = "gem"; + }; + version = "6.4.2"; + }; + racc = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "021s7maw0c4d9a6s07vbmllrzqsj2sgmrwimlh8ffkvwqdjrld09"; + type = "gem"; + }; + version = "1.8.0"; + }; + rack = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0hj0rkw2z9r1lcg2wlrcld2n3phwrcgqcp7qd1g9a7hwgalh2qzx"; + type = "gem"; + }; + version = "2.2.9"; + }; + rack-test = { + dependencies = ["rack"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1ysx29gk9k14a14zsp5a8czys140wacvp91fja8xcja0j1hzqq8c"; + type = "gem"; + }; + version = "2.1.0"; + }; + rails = { + dependencies = ["actioncable" "actionmailbox" "actionmailer" "actionpack" "actiontext" "actionview" "activejob" "activemodel" "activerecord" "activestorage" "activesupport" "railties"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1inqd2jjl9rd1yl85rn2wbbsln9i5x029hr5abgnwm8z5vc437fg"; + type = "gem"; + }; + version = "7.0.8.3"; + }; + rails-dom-testing = { + dependencies = ["activesupport" "minitest" "nokogiri"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0fx9dx1ag0s1lr6lfr34lbx5i1bvn3bhyf3w3mx6h7yz90p725g5"; + type = "gem"; + }; + version = "2.2.0"; + }; + rails-html-sanitizer = { + dependencies = ["loofah" "nokogiri"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1pm4z853nyz1bhhqr7fzl44alnx4bjachcr6rh6qjj375sfz3sc6"; + type = "gem"; + }; + version = "1.6.0"; + }; + railties = { + dependencies = ["actionpack" "activesupport" "method_source" "rake" "thor" "zeitwerk"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0sxki005rl1315mp78csayvfdx5zxjvwv8xmcfyjksgq27cimk5r"; + type = "gem"; + }; + version = "7.0.8.3"; + }; + rake = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "17850wcwkgi30p7yqh60960ypn7yibacjjha0av78zaxwvd3ijs6"; + type = "gem"; + }; + version = "13.2.1"; + }; + representable = { + dependencies = ["declarative" "trailblazer-option" "uber"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1kms3r6w6pnryysnaqqa9fsn0v73zx1ilds9d1c565n3xdzbyafc"; + type = "gem"; + }; + version = "3.2.0"; + }; + retriable = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1q48hqws2dy1vws9schc0kmina40gy7sn5qsndpsfqdslh65snha"; + type = "gem"; + }; + version = "3.1.2"; + }; + rexml = { + dependencies = ["strscan"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0d8ivcirrrxpkpjc1c835wknc9s2fl54xpw08s177yfrh5ish209"; + type = "gem"; + }; + version = "3.2.8"; + }; + ruby2_keywords = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1vz322p8n39hz3b4a9gkmz9y7a5jaz41zrm2ywf31dvkqm03glgz"; + type = "gem"; + }; + version = "0.0.5"; + }; + signet = { + dependencies = ["addressable" "faraday" "jwt" "multi_json"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0cfxa11wy1nv9slmnzjczkdgld0gqizajsb03rliy53zylwkjzsk"; + type = "gem"; + }; + version = "0.19.0"; + }; + strscan = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0mamrl7pxacbc79ny5hzmakc9grbjysm3yy6119ppgsg44fsif01"; + type = "gem"; + }; + version = "3.1.0"; + }; + thor = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1vq1fjp45az9hfp6fxljhdrkv75cvbab1jfrwcw738pnsiqk8zps"; + type = "gem"; + }; + version = "1.3.1"; + }; + timeliness = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0gvp9b7yn4pykn794cibylc9ys1lw7fzv7djx1433icxw4y26my3"; + type = "gem"; + }; + version = "0.3.10"; + }; + timeout = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "16mvvsmx90023wrhf8dxc1lpqh0m8alk65shb7xcya6a9gflw7vg"; + type = "gem"; + }; + version = "0.4.1"; + }; + trailblazer-option = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "18s48fndi2kfvrfzmq6rxvjfwad347548yby0341ixz1lhpg3r10"; + type = "gem"; + }; + version = "0.1.2"; + }; + tzinfo = { + dependencies = ["concurrent-ruby"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "16w2g84dzaf3z13gxyzlzbf748kylk5bdgg3n1ipvkvvqy685bwd"; + type = "gem"; + }; + version = "2.0.6"; + }; + uber = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1p1mm7mngg40x05z52md3mbamkng0zpajbzqjjwmsyw0zw3v9vjv"; + type = "gem"; + }; + version = "0.1.0"; + }; + websocket-driver = { + dependencies = ["websocket-extensions"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1nyh873w4lvahcl8kzbjfca26656d5c6z3md4sbqg5y1gfz0157n"; + type = "gem"; + }; + version = "0.7.6"; + }; + websocket-extensions = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0hc2g9qps8lmhibl5baa91b4qx8wqw872rgwagml78ydj8qacsqw"; + type = "gem"; + }; + version = "0.1.5"; + }; + zeitwerk = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1kr2731z8f6cj23jxh67cdnpkrnnfwbrxj1hfhshls4mp8i8drmj"; + type = "gem"; + }; + version = "2.6.15"; + }; +} diff --git a/pkgs/by-name/pg/pghero/package.nix b/pkgs/by-name/pg/pghero/package.nix new file mode 100644 index 000000000000..541496946982 --- /dev/null +++ b/pkgs/by-name/pg/pghero/package.nix @@ -0,0 +1,70 @@ +{ lib +, stdenv +, ruby +, bundlerEnv +, buildPackages +, fetchFromGitHub +, makeBinaryWrapper +, callPackage +}: +stdenv.mkDerivation (finalAttrs: +let + # Use bundlerEnvArgs from passthru to allow overriding bundlerEnv arguments. + rubyEnv = bundlerEnv finalAttrs.passthru.bundlerEnvArgs; + # We also need a separate nativeRubyEnv to precompile assets on the build + # host. If possible, reuse existing rubyEnv derivation. + nativeRubyEnv = + if stdenv.buildPlatform.canExecute stdenv.hostPlatform then rubyEnv + else buildPackages.bundlerEnv finalAttrs.passthru.bundlerEnvArgs; + + bundlerEnvArgs = { + name = "${finalAttrs.pname}-${finalAttrs.version}-gems"; + gemdir = ./.; + }; +in +{ + pname = "pghero"; + version = "3.5.0"; + + src = fetchFromGitHub { + owner = "pghero"; + repo = "pghero"; + rev = "v${finalAttrs.version}"; + hash = "sha256-6JShYn3QfxPdAVcrJ7/kxzxa4dBEzSkUiLguIH+VCRQ="; + }; + + strictDeps = true; + nativeBuildInputs = [ nativeRubyEnv makeBinaryWrapper ]; + + inherit rubyEnv; + + buildPhase = '' + runHook preBuild + DATABASE_URL=nulldb:/// RAILS_ENV=production rake assets:precompile + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + mkdir -p -- "$out"/{share,bin} + cp -a -- . "$out"/share/pghero + makeWrapper "$rubyEnv"/bin/puma "$out"/bin/pghero \ + --add-flags -C \ + --add-flags config/puma.rb \ + --chdir "$out"/share/pghero + runHook postInstall + ''; + + passthru = { + inherit bundlerEnvArgs; + updateScript = callPackage ./update.nix { }; + }; + + meta = { + homepage = "https://github.com/ankane/pghero"; + description = "Performance dashboard for Postgres"; + mainProgram = "pghero"; + license = lib.licenses.mit; + maintainers = [ lib.maintainers.tie ]; + }; +}) diff --git a/pkgs/by-name/pg/pghero/update.nix b/pkgs/by-name/pg/pghero/update.nix new file mode 100644 index 000000000000..35edcec7b6af --- /dev/null +++ b/pkgs/by-name/pg/pghero/update.nix @@ -0,0 +1,59 @@ +{ lib +, writeShellScript +, git +, nix +, bundler +, bundix +, coreutils +, common-updater-scripts +}: +writeShellScript "update-script" '' + set -eu + PATH=${lib.makeBinPath [ + git + nix + bundler + bundix + coreutils + common-updater-scripts + ]} + nix() { + command nix --extra-experimental-features nix-command "$@" + } + bundle() { + BUNDLE_FORCE_RUBY_PLATFORM=1 command bundle "$@" + } + + attrPath=''${UPDATE_NIX_ATTR_PATH:-pghero} + + toplevel=$(git rev-parse --show-toplevel) + position=$(nix eval --file "$toplevel" --raw "$attrPath.meta.position") + gemdir=$(dirname "$position") + + cd "$gemdir" + + tempdir=$(mktemp -d) + cleanup() { + rc=$? + rm -r -- "$tempdir" || true + exit $rc + } + trap cleanup EXIT + + cp gemset.nix "$tempdir" + + bundle lock --update --lockfile="$tempdir"/Gemfile.lock + bundix --lockfile="$tempdir"/Gemfile.lock --gemset="$tempdir"/gemset.nix + + oldVersion=''${UPDATE_NIX_OLD_VERSION-} + newVersion=$(nix eval --file "$tempdir"/gemset.nix --raw pghero.version) + + if [ "$oldVersion" = "$newVersion" ]; then + exit + fi + + cp "$tempdir"/{Gemfile.lock,gemset.nix} . + + cd "$toplevel" + update-source-version "$attrPath" "$newVersion" --file="$gemdir"/package.nix --ignore-same-hash +'' From a5499ee5356975f4bc50a0e24fc6238f48fc4666 Mon Sep 17 00:00:00 2001 From: Ivan Trubach Date: Thu, 23 Nov 2023 13:59:27 +0300 Subject: [PATCH 2/2] nixos/pghero: init --- nixos/modules/module-list.nix | 1 + nixos/modules/services/misc/pghero.nix | 142 +++++++++++++++++++++++++ nixos/tests/all-tests.nix | 1 + nixos/tests/pghero.nix | 63 +++++++++++ pkgs/by-name/pg/pghero/package.nix | 4 + 5 files changed, 211 insertions(+) create mode 100644 nixos/modules/services/misc/pghero.nix create mode 100644 nixos/tests/pghero.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 159696be8b6d..387c043a7d18 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -775,6 +775,7 @@ ./services/misc/paperless.nix ./services/misc/parsoid.nix ./services/misc/persistent-evdev.nix + ./services/misc/pghero.nix ./services/misc/pinnwand.nix ./services/misc/plex.nix ./services/misc/plikd.nix diff --git a/nixos/modules/services/misc/pghero.nix b/nixos/modules/services/misc/pghero.nix new file mode 100644 index 000000000000..39515f10c8e1 --- /dev/null +++ b/nixos/modules/services/misc/pghero.nix @@ -0,0 +1,142 @@ +{ config, pkgs, lib, utils, ... }: +let + cfg = config.services.pghero; + settingsFormat = pkgs.formats.yaml { }; + settingsFile = settingsFormat.generate "pghero.yaml" cfg.settings; +in +{ + options.services.pghero = { + enable = lib.mkEnableOption "PgHero service"; + package = lib.mkPackageOption pkgs "pghero" { }; + + listenAddress = lib.mkOption { + type = lib.types.str; + example = "[::1]:3000"; + description = '' + `hostname:port` to listen for HTTP traffic. + + This is bound using the systemd socket activation. + ''; + }; + + extraArgs = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + description = '' + Additional command-line arguments for the systemd service. + + Refer to the [Puma web server documentation] for available arguments. + + [Puma web server documentation]: https://puma.io/puma#configuration + ''; + }; + + settings = lib.mkOption { + type = settingsFormat.type; + default = { }; + example = { + databases = { + primary = { + url = "<%= ENV['PRIMARY_DATABASE_URL'] %>"; + }; + }; + }; + description = '' + PgHero configuration. Refer to the [PgHero documentation] for more + details. + + [PgHero documentation]: https://github.com/ankane/pghero/blob/master/guides/Linux.md#multiple-databases + ''; + }; + + environment = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + default = { }; + description = '' + Environment variables to set for the service. Secrets should be + specified using {option}`environmentFile`. + ''; + }; + + environmentFiles = lib.mkOption { + type = lib.types.listOf lib.types.path; + default = [ ]; + description = '' + File to load environment variables from. Loaded variables override + values set in {option}`environment`. + ''; + }; + + extraGroups = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + example = [ "tlskeys" ]; + description = '' + Additional groups for the systemd service. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + systemd.sockets.pghero = { + unitConfig.Description = "PgHero HTTP socket"; + wantedBy = [ "sockets.target" ]; + listenStreams = [ cfg.listenAddress ]; + }; + + systemd.services.pghero = { + description = "PgHero performance dashboard for PostgreSQL"; + wantedBy = [ "multi-user.target" ]; + requires = [ "pghero.socket" ]; + after = [ "pghero.socket" "network.target" ]; + + environment = { + RAILS_ENV = "production"; + PGHERO_CONFIG_PATH = settingsFile; + } // cfg.environment; + + serviceConfig = { + Type = "notify"; + WatchdogSec = "10"; + + ExecStart = utils.escapeSystemdExecArgs ([ + (lib.getExe cfg.package) + "--bind-to-activated-sockets" + "only" + ] ++ cfg.extraArgs); + Restart = "always"; + + WorkingDirectory = "${cfg.package}/share/pghero"; + + EnvironmentFile = cfg.environmentFiles; + SupplementaryGroups = cfg.extraGroups; + + DynamicUser = true; + UMask = "0077"; + + ProtectHome = true; + ProtectProc = "invisible"; + ProcSubset = "pid"; + ProtectClock = true; + ProtectHostname = true; + ProtectControlGroups = true; + ProtectKernelLogs = true; + ProtectKernelModules = true; + ProtectKernelTunables = true; + PrivateUsers = true; + PrivateDevices = true; + RestrictRealtime = true; + RestrictNamespaces = true; + RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ]; + DeviceAllow = [ "" ]; + DevicePolicy = "closed"; + CapabilityBoundingSet = [ "" ]; + MemoryDenyWriteExecute = true; + LockPersonality = true; + SystemCallArchitectures = "native"; + SystemCallErrorNumber = "EPERM"; + SystemCallFilter = [ "@system-service" ]; + }; + }; + }; +} diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index a2408a43ecc9..4a3b2ffc4f8c 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -717,6 +717,7 @@ in { pg_anonymizer = handleTest ./pg_anonymizer.nix {}; pgadmin4 = handleTest ./pgadmin4.nix {}; pgbouncer = handleTest ./pgbouncer.nix {}; + pghero = runTest ./pghero.nix; pgjwt = handleTest ./pgjwt.nix {}; pgmanage = handleTest ./pgmanage.nix {}; pgvecto-rs = handleTest ./pgvecto-rs.nix {}; diff --git a/nixos/tests/pghero.nix b/nixos/tests/pghero.nix new file mode 100644 index 000000000000..bce32da00886 --- /dev/null +++ b/nixos/tests/pghero.nix @@ -0,0 +1,63 @@ +let + pgheroPort = 1337; + pgheroUser = "pghero"; + pgheroPass = "pghero"; +in +{ lib, ... }: { + name = "pghero"; + meta.maintainers = [ lib.maintainers.tie ]; + + nodes.machine = { config, ... }: { + services.postgresql = { + enable = true; + # This test uses default peer authentication (socket and its directory is + # world-readably by default), so we essentially test that we can connect + # with DynamicUser= set. + ensureUsers = [{ + name = "pghero"; + ensureClauses.superuser = true; + }]; + }; + services.pghero = { + enable = true; + listenAddress = "[::]:${toString pgheroPort}"; + settings = { + databases = { + postgres.url = "<%= ENV['POSTGRES_DATABASE_URL'] %>"; + nulldb.url = "nulldb:///"; + }; + }; + environment = { + PGHERO_USERNAME = pgheroUser; + PGHERO_PASSWORD = pgheroPass; + POSTGRES_DATABASE_URL = "postgresql:///postgres?host=/run/postgresql"; + }; + }; + }; + + testScript = '' + pgheroPort = ${toString pgheroPort} + pgheroUser = "${pgheroUser}" + pgheroPass = "${pgheroPass}" + + pgheroUnauthorizedURL = f"http://localhost:{pgheroPort}" + pgheroBaseURL = f"http://{pgheroUser}:{pgheroPass}@localhost:{pgheroPort}" + + def expect_http_code(node, code, url): + http_code = node.succeed(f"curl -s -o /dev/null -w '%{{http_code}}' '{url}'") + assert http_code.split("\n")[-1].strip() == code, \ + f"expected HTTP status code {code} but got {http_code}" + + machine.wait_for_unit("postgresql.service") + machine.wait_for_unit("pghero.service") + + with subtest("requires HTTP Basic Auth credentials"): + expect_http_code(machine, "401", pgheroUnauthorizedURL) + + with subtest("works with some databases being unavailable"): + expect_http_code(machine, "500", pgheroBaseURL + "/nulldb") + + with subtest("connects to the PostgreSQL database"): + expect_http_code(machine, "200", pgheroBaseURL + "/postgres") + ''; +} diff --git a/pkgs/by-name/pg/pghero/package.nix b/pkgs/by-name/pg/pghero/package.nix index 541496946982..0f74a39add63 100644 --- a/pkgs/by-name/pg/pghero/package.nix +++ b/pkgs/by-name/pg/pghero/package.nix @@ -5,6 +5,7 @@ , buildPackages , fetchFromGitHub , makeBinaryWrapper +, nixosTests , callPackage }: stdenv.mkDerivation (finalAttrs: @@ -58,6 +59,9 @@ in passthru = { inherit bundlerEnvArgs; updateScript = callPackage ./update.nix { }; + tests = { + inherit (nixosTests) pghero; + }; }; meta = {