From 47afdc46275834f3d6ecb0021dbdda9b77f3729d Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sun, 29 Aug 2021 02:28:38 +0200 Subject: [PATCH 01/16] nixos/gnome: enable platform integration for Qt Qt links against GTK to be able to use native GTK file chooser in GTK-oriented DEs. However, GTK expects a specific environment, which means the application needs to be wrapped to prevent crashes when file chooser is opened in some environments. This patch bypasses the need for wrapping Qt applications with GTK-related environment since the file chooser dialogue will now come from a separate process (instantiated by the XDG desktop portal via D-Bus). In the future, we could remove the GTK dependency from Qt to fix the crashes on non-{GNOME,Pantheon} environments. Then, users would be able to choose between non-native Qt dialogue or native one facilitated by XDG portals (e.g. through setting `QT_QPA_PLATFORMTHEME` to either `qgnomeplatform`, or `xdgdesktopportal`). One disadvantage is adding a Qt dependency to GNOME, even for people who might not use any Qt apps. But they can easily just add `qt5.enable = false;` to their NixOS configuration. The configuration is also presumably less battle tested than plain Qt with its first-party GTK integration. But it is backed by Fedora and used by Manjaro GNOME so it cannot be that bad. Lastly, I worry about ABI compatibility of the platform modules with apps installed from different Nixpkgs revision. --- .../doc/manual/from_md/release-notes/rl-2111.section.xml | 9 +++++++++ nixos/doc/manual/release-notes/rl-2111.section.md | 2 ++ nixos/modules/services/x11/desktop-managers/gnome.nix | 7 +++++++ 3 files changed, 18 insertions(+) diff --git a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml index b922f9f12082..cd8f9e316412 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml @@ -1088,6 +1088,15 @@ Superuser created successfully. but instead use more of the YAML-specific syntax. + + + GNOME desktop environment now enables + QGnomePlatform as the Qt platform theme, + which should avoid crashes when opening file chooser dialogs + in Qt apps by using XDG desktop portal. Additionally, it will + make the apps fit better visually. + + diff --git a/nixos/doc/manual/release-notes/rl-2111.section.md b/nixos/doc/manual/release-notes/rl-2111.section.md index c7e5afb7d0af..0bc35cdb643a 100644 --- a/nixos/doc/manual/release-notes/rl-2111.section.md +++ b/nixos/doc/manual/release-notes/rl-2111.section.md @@ -311,3 +311,5 @@ To be able to access the web UI this port needs to be opened in the firewall. - Nginx will use the value of `sslTrustedCertificate` if provided for a virtual host, even if `enableACME` is set. This is useful for providers not using the same certificate to sign OCSP responses and server certificates. - `lib.formats.yaml`'s `generate` will not generate JSON anymore, but instead use more of the YAML-specific syntax. + +- GNOME desktop environment now enables `QGnomePlatform` as the Qt platform theme, which should avoid crashes when opening file chooser dialogs in Qt apps by using XDG desktop portal. Additionally, it will make the apps fit better visually. diff --git a/nixos/modules/services/x11/desktop-managers/gnome.nix b/nixos/modules/services/x11/desktop-managers/gnome.nix index b0859321a525..4bc42525906c 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome.nix @@ -372,6 +372,13 @@ in xdg.portal.enable = true; xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + # Harmonize Qt5 application style and also make them use the portal for file chooser dialog. + qt5 = { + enable = mkDefault true; + platformTheme = mkDefault "gnome"; + style = mkDefault "adwaita"; + }; + networking.networkmanager.enable = mkDefault true; services.xserver.updateDbusEnvironment = true; From 882899981d4bc23cba35d30221b2281ec5d173ef Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sun, 29 Aug 2021 03:41:56 +0200 Subject: [PATCH 02/16] =?UTF-8?q?qgnomeplatform:=200.6.1=20=E2=86=92=200.8?= =?UTF-8?q?.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - https://github.com/FedoraQt/QGnomePlatform/releases/tag/0.7.0 - https://github.com/FedoraQt/QGnomePlatform/releases/tag/0.7.1 - https://github.com/FedoraQt/QGnomePlatform/releases/tag/0.8.0 --- .../libraries/qgnomeplatform/default.nix | 25 ++++++++----------- .../qgnomeplatform/hardcode-gsettings.patch | 15 +++++------ pkgs/top-level/all-packages.nix | 2 +- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/pkgs/development/libraries/qgnomeplatform/default.nix b/pkgs/development/libraries/qgnomeplatform/default.nix index e3bb938f5f8f..bfb1859ba655 100644 --- a/pkgs/development/libraries/qgnomeplatform/default.nix +++ b/pkgs/development/libraries/qgnomeplatform/default.nix @@ -2,12 +2,12 @@ , lib , fetchFromGitHub , nix-update-script +, cmake , pkg-config -, gtk3 +, adwaita-qt , glib +, gtk3 , qtbase -, qmake -, qtx11extras , pantheon , substituteAll , gsettings-desktop-schemas @@ -15,13 +15,13 @@ mkDerivation rec { pname = "qgnomeplatform"; - version = "0.6.1"; + version = "0.8.0"; src = fetchFromGitHub { owner = "FedoraQt"; repo = "QGnomePlatform"; rev = version; - sha256 = "1mwqg2zk0sfjq54vz2jjahbgi5sxw8rb71h6mgg459wp99mhlqi0"; + sha256 = "C/n8i5j0UWfxhP10c4j89U+LrpPozXnam4fIPYMXZAA="; }; patches = [ @@ -33,24 +33,21 @@ mkDerivation rec { ]; nativeBuildInputs = [ + cmake pkg-config - qmake ]; buildInputs = [ + adwaita-qt glib gtk3 qtbase - qtx11extras ]; - postPatch = '' - # Fix plugin dir - substituteInPlace decoration/decoration.pro \ - --replace "\$\$[QT_INSTALL_PLUGINS]" "$out/$qtPluginPrefix" - substituteInPlace theme/theme.pro \ - --replace "\$\$[QT_INSTALL_PLUGINS]" "$out/$qtPluginPrefix" - ''; + cmakeFlags = [ + "-DGLIB_SCHEMAS_DIR=${glib.getSchemaPath gsettings-desktop-schemas}" + "-DQT_PLUGINS_DIR=${placeholder "out"}/${qtbase.qtPluginPrefix}" + ]; passthru = { updateScript = nix-update-script { diff --git a/pkgs/development/libraries/qgnomeplatform/hardcode-gsettings.patch b/pkgs/development/libraries/qgnomeplatform/hardcode-gsettings.patch index 9b342d7cf832..40f7f98f25c7 100644 --- a/pkgs/development/libraries/qgnomeplatform/hardcode-gsettings.patch +++ b/pkgs/development/libraries/qgnomeplatform/hardcode-gsettings.patch @@ -1,13 +1,14 @@ -diff --git a/common/gnomehintssettings.cpp b/common/gnomehintssettings.cpp -index 9860e57..40fa6ec 100644 ---- a/common/gnomehintssettings.cpp -+++ b/common/gnomehintssettings.cpp -@@ -80,9 +80,17 @@ void gtkMessageHandler(const gchar *log_domain, - GnomeHintsSettings::GnomeHintsSettings() - : QObject(0) +diff --git a/src/common/gnomesettings.cpp b/src/common/gnomesettings.cpp +index 717cc9b..ee255ea 100644 +--- a/src/common/gnomesettings.cpp ++++ b/src/common/gnomesettings.cpp +@@ -150,10 +150,18 @@ GnomeSettingsPrivate::GnomeSettingsPrivate(QObject *parent) + : GnomeSettings(parent) , m_usePortal(checkUsePortalSupport()) + , m_canUseFileChooserPortal(!m_usePortal) - , m_gnomeDesktopSettings(g_settings_new("org.gnome.desktop.wm.preferences")) - , m_settings(g_settings_new("org.gnome.desktop.interface")) + , m_fallbackFont(new QFont(QLatin1String("Sans"), 10)) { + g_autoptr(GSettingsSchemaSource) schemaSource = nullptr; + g_autoptr(GSettingsSchema) gnomeDesktopSchema = nullptr; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bebdc797d2e4..c3d3b848edf2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18499,7 +18499,7 @@ with pkgs; qrupdate = callPackage ../development/libraries/qrupdate { }; - qgnomeplatform = libsForQt514.callPackage ../development/libraries/qgnomeplatform { }; + qgnomeplatform = libsForQt5.callPackage ../development/libraries/qgnomeplatform { }; randomx = callPackage ../development/libraries/randomx { }; From f4f2057a76507fb23717ceb5cede2f80b4dfc77d Mon Sep 17 00:00:00 2001 From: Malte Voos Date: Thu, 20 May 2021 19:34:20 +0200 Subject: [PATCH 03/16] nixos/soju: add module --- nixos/modules/module-list.nix | 1 + nixos/modules/services/networking/soju.nix | 113 +++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 nixos/modules/services/networking/soju.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 71a1118fd38e..ce948bac4282 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -833,6 +833,7 @@ ./services/networking/smokeping.nix ./services/networking/softether.nix ./services/networking/solanum.nix + ./services/networking/soju.nix ./services/networking/spacecookie.nix ./services/networking/spiped.nix ./services/networking/squid.nix diff --git a/nixos/modules/services/networking/soju.nix b/nixos/modules/services/networking/soju.nix new file mode 100644 index 000000000000..68a33e9dccba --- /dev/null +++ b/nixos/modules/services/networking/soju.nix @@ -0,0 +1,113 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.soju; + stateDir = "/var/lib/soju"; + listenCfg = concatMapStringsSep "\n" (l: "listen ${l}") cfg.listen; + tlsCfg = optionalString (cfg.tlsCertificate != null) + "tls ${cfg.tlsCertificate} ${cfg.tlsCertificateKey}"; + logCfg = optionalString cfg.enableMessageLogging + "log fs ${stateDir}/logs"; + + configFile = pkgs.writeText "soju.conf" '' + ${listenCfg} + hostname ${cfg.hostName} + ${tlsCfg} + db sqlite3 ${stateDir}/soju.db + ${logCfg} + http-origin ${concatStringsSep " " cfg.httpOrigins} + accept-proxy-ip ${concatStringsSep " " cfg.acceptProxyIP} + + ${cfg.extraConfig} + ''; +in +{ + ###### interface + + options.services.soju = { + enable = mkEnableOption "soju"; + + listen = mkOption { + type = types.listOf types.str; + default = [ ":6697" ]; + description = '' + Where soju should listen for incoming connections. See the + listen directive in + soju + 1. + ''; + }; + + hostName = mkOption { + type = types.str; + default = config.networking.hostName; + description = "Server hostname."; + }; + + tlsCertificate = mkOption { + type = types.nullOr types.path; + example = "/var/host.cert"; + description = "Path to server TLS certificate."; + }; + + tlsCertificateKey = mkOption { + type = types.nullOr types.path; + example = "/var/host.key"; + description = "Path to server TLS certificate key."; + }; + + enableMessageLogging = mkOption { + type = types.bool; + default = true; + description = "Whether to enable message logging."; + }; + + httpOrigins = mkOption { + type = types.listOf types.str; + default = []; + description = '' + List of allowed HTTP origins for WebSocket listeners. The parameters are + interpreted as shell patterns, see + glob + 7. + ''; + }; + + acceptProxyIP = mkOption { + type = types.listOf types.str; + default = []; + description = '' + Allow the specified IPs to act as a proxy. Proxys have the ability to + overwrite the remote and local connection addresses (via the X-Forwarded-\* + HTTP header fields). The special name "localhost" accepts the loopback + addresses 127.0.0.0/8 and ::1/128. By default, all IPs are rejected. + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = "Lines added verbatim to the configuration file."; + }; + }; + + ###### implementation + + config = mkIf cfg.enable { + systemd.services.soju = { + description = "soju IRC bouncer"; + wantedBy = [ "multi-user.target" ]; + after = [ "network-online.target" ]; + serviceConfig = { + DynamicUser = true; + Restart = "always"; + ExecStart = "${pkgs.soju}/bin/soju -config ${configFile}"; + StateDirectory = "soju"; + }; + }; + }; + + meta.maintainers = with maintainers; [ malvo ]; +} From 9d822d20472fd53b3f521e2780322446055bf010 Mon Sep 17 00:00:00 2001 From: Malte Voos Date: Fri, 4 Jun 2021 16:30:27 +0200 Subject: [PATCH 04/16] nixos/soju: add 21.11 release notes entry --- nixos/doc/manual/from_md/release-notes/rl-2111.section.xml | 7 +++++++ nixos/doc/manual/release-notes/rl-2111.section.md | 2 ++ 2 files changed, 9 insertions(+) diff --git a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml index b922f9f12082..e4c765361d72 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml @@ -207,6 +207,13 @@ postfixadmin. + + + soju, a + user-friendly IRC bouncer. Available as + services.soju. + +
diff --git a/nixos/doc/manual/release-notes/rl-2111.section.md b/nixos/doc/manual/release-notes/rl-2111.section.md index c7e5afb7d0af..14c51d418e69 100644 --- a/nixos/doc/manual/release-notes/rl-2111.section.md +++ b/nixos/doc/manual/release-notes/rl-2111.section.md @@ -62,6 +62,8 @@ subsonic-compatible api. Available as [navidrome](#opt-services.navidrome.enable - [postfixadmin](https://postfixadmin.sourceforge.io/), a web based virtual user administration interface for Postfix mail servers. Available as [postfixadmin](#opt-services.postfixadmin.enable). +- [soju](https://sr.ht/~emersion/soju), a user-friendly IRC bouncer. Available as [services.soju](options.html#opt-services.soju.enable). + ## Backward Incompatibilities {#sec-release-21.11-incompatibilities} From 00fa834e558bca1feeedae4ec9b6cd55bfe4281d Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Wed, 1 Sep 2021 07:37:23 -0500 Subject: [PATCH 05/16] nodejs-12_x: 12.22.5 -> 12.22.6 https://github.com/nodejs/node/releases/tag/v12.22.6 --- pkgs/development/web/nodejs/v12.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/web/nodejs/v12.nix b/pkgs/development/web/nodejs/v12.nix index e59b79594203..7717dfa6c9cf 100644 --- a/pkgs/development/web/nodejs/v12.nix +++ b/pkgs/development/web/nodejs/v12.nix @@ -8,7 +8,7 @@ let in buildNodejs { inherit enableNpm; - version = "12.22.5"; - sha256 = "057xhxk440pxlgqpblsh4vfwmfzy0fx1h6q3jr2j79y559ngy9zr"; + version = "12.22.6"; + sha256 = "0yhgkcp7lx5nglxsrybbjymx1fys3wkbbhkj6h6652gnp0b2y0n2"; patches = lib.optional stdenv.isDarwin ./bypass-xcodebuild.diff; } From aff25d4cf0b0461cd2fc7790518593984822cb6c Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Wed, 1 Sep 2021 07:37:51 -0500 Subject: [PATCH 06/16] nodejs-14_x: 14.17.5 -> 14.17.6 https://github.com/nodejs/node/releases/tag/v14.17.6 --- pkgs/development/web/nodejs/v14.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/web/nodejs/v14.nix b/pkgs/development/web/nodejs/v14.nix index bad8ebfa5aed..1ec04407f899 100644 --- a/pkgs/development/web/nodejs/v14.nix +++ b/pkgs/development/web/nodejs/v14.nix @@ -7,7 +7,7 @@ let in buildNodejs { inherit enableNpm; - version = "14.17.5"; - sha256 = "1a0zj505nhpfcj19qvjy2hvc5a7gadykv51y0rc6032qhzzsgca2"; + version = "14.17.6"; + sha256 = "0pmd0haav2ychhcsw44klx6wfn8c7j1rsw08rc8hcm5i3h5wsn7l"; patches = lib.optional stdenv.isDarwin ./bypass-xcodebuild.diff; } From bbf089dfb7e5e99a571647bf29734f3f7babdec7 Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Wed, 1 Sep 2021 21:44:21 +0200 Subject: [PATCH 07/16] wesnoth: 1.4.16 -> 1.4.17 --- pkgs/games/wesnoth/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/games/wesnoth/default.nix b/pkgs/games/wesnoth/default.nix index 6eedc446f53f..08346f440d0b 100644 --- a/pkgs/games/wesnoth/default.nix +++ b/pkgs/games/wesnoth/default.nix @@ -6,13 +6,13 @@ stdenv.mkDerivation rec { pname = "wesnoth"; - version = "1.14.16"; + version = "1.14.17"; src = fetchFromGitHub { rev = version; owner = "wesnoth"; repo = "wesnoth"; - sha256 = "sha256-QMz7atxol18r//UNb6+H6xAAEQdR4hAN8UW0KeGSH1g="; + sha256 = "RZ38MbUaUjfajo9wXSfDt8NHBySC+ODlgZAPf2NPblc="; }; nativeBuildInputs = [ cmake pkg-config ]; From 96f02afbe58d243835c9b7da811c6bab61690ed9 Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Wed, 1 Sep 2021 21:49:06 +0200 Subject: [PATCH 08/16] wesnoth: fix license information source: https://github.com/wesnoth/wesnoth/blob/master/copyright --- pkgs/games/wesnoth/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/games/wesnoth/default.nix b/pkgs/games/wesnoth/default.nix index 08346f440d0b..ae23cc799ceb 100644 --- a/pkgs/games/wesnoth/default.nix +++ b/pkgs/games/wesnoth/default.nix @@ -34,7 +34,7 @@ stdenv.mkDerivation rec { ''; homepage = "https://www.wesnoth.org/"; - license = licenses.gpl2; + license = licenses.gpl2Plus; maintainers = with maintainers; [ abbradar ]; platforms = platforms.unix; }; From 023a3fae1809788f7c2dc8fc0ccf6abbb19508dc Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Wed, 1 Sep 2021 21:20:43 +0000 Subject: [PATCH 09/16] python38Packages.pex: 2.1.46 -> 2.1.47 --- pkgs/development/python-modules/pex/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/pex/default.nix b/pkgs/development/python-modules/pex/default.nix index 5145bec925a9..b4238e6594f0 100644 --- a/pkgs/development/python-modules/pex/default.nix +++ b/pkgs/development/python-modules/pex/default.nix @@ -6,11 +6,11 @@ buildPythonPackage rec { pname = "pex"; - version = "2.1.46"; + version = "2.1.47"; src = fetchPypi { inherit pname version; - sha256 = "28958292ab6a149ef7dd7998939a6e899b2f1ba811407ea1edac9d2d84417dfd"; + sha256 = "0928d0316caac840db528030fc741930e8be22a3fa6a8635308fb8443a0a0c6a"; }; nativeBuildInputs = [ setuptools ]; From 27a37154dee56bd7eff4d33e0c1b9747e69cb4ac Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Wed, 1 Sep 2021 16:53:21 -0700 Subject: [PATCH 10/16] monit: 5.27.2 -> 5.29.0; format --- pkgs/tools/system/monit/default.nix | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/pkgs/tools/system/monit/default.nix b/pkgs/tools/system/monit/default.nix index 9e176677c761..93cdbe6d546e 100644 --- a/pkgs/tools/system/monit/default.nix +++ b/pkgs/tools/system/monit/default.nix @@ -1,17 +1,22 @@ -{ lib, stdenv -, fetchurl, bison, flex +{ lib +, stdenv +, fetchurl +, bison +, flex , zlib -, usePAM ? stdenv.hostPlatform.isLinux, pam -, useSSL ? true, openssl +, usePAM ? stdenv.hostPlatform.isLinux +, pam +, useSSL ? true +, openssl }: stdenv.mkDerivation rec { pname = "monit"; - version = "5.27.2"; + version = "5.29.0"; src = fetchurl { url = "${meta.homepage}dist/monit-${version}.tar.gz"; - sha256 = "sha256-2ICceNXcHtenujKlpVxRFIVRMsxNpIBfjTqvjPRuqkw="; + sha256 = "sha256-9mXm3R8mp0tWgomah3k0Fn3islguBIZS7PA2MYR3iF8="; }; nativeBuildInputs = [ bison flex ]; @@ -22,10 +27,10 @@ stdenv.mkDerivation rec { configureFlags = [ (lib.withFeature usePAM "pam") ] ++ (if useSSL then [ - "--with-ssl-incl-dir=${openssl.dev}/include" - "--with-ssl-lib-dir=${openssl.out}/lib" - ] else [ - "--without-ssl" + "--with-ssl-incl-dir=${openssl.dev}/include" + "--with-ssl-lib-dir=${openssl.out}/lib" + ] else [ + "--without-ssl" ]) ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ # will need to check both these are true for musl "libmonit_cv_setjmp_available=yes" @@ -33,7 +38,7 @@ stdenv.mkDerivation rec { ]; meta = { - homepage = "http://mmonit.com/monit/"; + homepage = "https://mmonit.com/monit/"; description = "Monitoring system"; license = lib.licenses.agpl3; maintainers = with lib.maintainers; [ raskin wmertens ryantm ]; From ea4b37e6790b7d3e03ee29cb050e5c76f11245ac Mon Sep 17 00:00:00 2001 From: Matt Votava Date: Wed, 1 Sep 2021 18:37:54 -0700 Subject: [PATCH 11/16] buildFhsUserenv: inherit mounts from parent namespace --- pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c b/pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c index 27e70e3fe5c4..324c9d24ba04 100644 --- a/pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c +++ b/pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c @@ -122,7 +122,7 @@ int main(gint argc, gchar **argv) { } // hide all mounts we do from the parent - fail_if(mount(0, "/", 0, MS_PRIVATE | MS_REC, 0)); + fail_if(mount(0, "/", 0, MS_SLAVE | MS_REC, 0)); if (uid != 0) { spit("/proc/self/setgroups", "deny"); From 070fa4cefc5b7bd0c8f95850adfcb4f0bf4bd09a Mon Sep 17 00:00:00 2001 From: happysalada Date: Tue, 31 Aug 2021 18:03:46 +0900 Subject: [PATCH 12/16] elixir_ls: add update script --- pkgs/development/beam-modules/default.nix | 2 +- .../{elixir_ls.nix => elixir-ls/default.nix} | 1 + .../beam-modules/elixir-ls/update.sh | 32 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) rename pkgs/development/beam-modules/{elixir_ls.nix => elixir-ls/default.nix} (98%) create mode 100755 pkgs/development/beam-modules/elixir-ls/update.sh diff --git a/pkgs/development/beam-modules/default.nix b/pkgs/development/beam-modules/default.nix index b6be8c3e7fbd..1c9d5099b44f 100644 --- a/pkgs/development/beam-modules/default.nix +++ b/pkgs/development/beam-modules/default.nix @@ -76,7 +76,7 @@ let debugInfo = true; }; - elixir_ls = callPackage ./elixir_ls.nix { inherit elixir fetchMixDeps mixRelease; }; + elixir_ls = callPackage ./elixir-ls { inherit elixir fetchMixDeps mixRelease; }; lfe = lfe_1_3; lfe_1_3 = lib'.callLFE ../interpreters/lfe/1.3.nix { inherit erlang buildRebar3 buildHex; }; diff --git a/pkgs/development/beam-modules/elixir_ls.nix b/pkgs/development/beam-modules/elixir-ls/default.nix similarity index 98% rename from pkgs/development/beam-modules/elixir_ls.nix rename to pkgs/development/beam-modules/elixir-ls/default.nix index 2b6cc4f56810..56aa47f59f9f 100644 --- a/pkgs/development/beam-modules/elixir_ls.nix +++ b/pkgs/development/beam-modules/elixir-ls/default.nix @@ -68,4 +68,5 @@ mixRelease rec { platforms = platforms.unix; maintainers = teams.beam.members; }; + passthru.updateScript = ./update.sh; } diff --git a/pkgs/development/beam-modules/elixir-ls/update.sh b/pkgs/development/beam-modules/elixir-ls/update.sh new file mode 100755 index 000000000000..8bc1c2b6e966 --- /dev/null +++ b/pkgs/development/beam-modules/elixir-ls/update.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env nix-shell +#! nix-shell -i oil -p jq sd nix-prefetch-github ripgrep + +# TODO set to `verbose` or `extdebug` once implemented in oil +shopt --set xtrace + +var directory = $(dirname $0 | xargs realpath) +var owner = "elixir-lsp" +var repo = "elixir-ls" +var latest_rev = $(curl -q https://api.github.com/repos/${owner}/${repo}/releases/latest | \ + jq -r '.tag_name') +var latest_version = $(echo $latest_rev | sd 'v' '') +var current_version = $(nix-instantiate -A elixir_ls.version --eval --json | jq -r) +if ("$latest_version" == "$current_version") { + echo "elixir-ls is already up-to-date" + return 0 +} else { + var tarball_meta = $(nix-prefetch-github $owner $repo --rev "$latest_rev") + var tarball_hash = "sha256-$(echo $tarball_meta | jq -r '.sha256')" + var sha256s = $(rg '"sha256-.+"' $directory/default.nix | sd '.+"(.+)";' '$1' ) + echo $sha256s | read --line :github_sha256 + echo $sha256s | tail -n 1 | read --line :old_mix_sha256 + sd 'version = ".+"' "version = \"$latest_version\"" "$directory/default.nix" + sd "sha256 = \"$github_sha256\"" "sha256 = \"$tarball_hash\"" "$directory/default.nix" + sd "sha256 = \"$old_mix_sha256\"" "sha256 = \"\"" "$directory/default.nix" + + var new_mix_hash = $(nix-build -A elixir_ls.mixFodDeps 2>&1 | \ + tail -n 1 | \ + sd '\s+got:\s+' '') + + sd "sha256 = \"\"" "sha256 = \"$new_mix_hash\"" "$directory/default.nix" +} From 3b7fa8744ccb957ce20304f6b9ec68325671ae11 Mon Sep 17 00:00:00 2001 From: happysalada Date: Tue, 31 Aug 2021 10:30:17 +0900 Subject: [PATCH 13/16] elasticsearch7: wrap elasticcearch-keystore --- pkgs/servers/search/elasticsearch/7.x.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/servers/search/elasticsearch/7.x.nix b/pkgs/servers/search/elasticsearch/7.x.nix index b0114ad17055..de194bcc7d29 100644 --- a/pkgs/servers/search/elasticsearch/7.x.nix +++ b/pkgs/servers/search/elasticsearch/7.x.nix @@ -59,6 +59,9 @@ stdenv.mkDerivation (rec { chmod +x $out/bin/* + substituteInPlace $out/bin/elasticsearch \ + --replace 'bin/elasticsearch-keystore' "$out/bin/elasticsearch-keystore" + wrapProgram $out/bin/elasticsearch \ --prefix PATH : "${makeBinPath [ util-linux coreutils gnugrep ]}" \ --set JAVA_HOME "${jre_headless}" From e13906fff009043e8982567ca6bc1a031b62f388 Mon Sep 17 00:00:00 2001 From: happysalada Date: Wed, 1 Sep 2021 15:51:33 +0900 Subject: [PATCH 14/16] elasticsearch: nixpkgs-fmt --- nixos/modules/services/search/elasticsearch.nix | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix index 91d8f544e16b..e78ed7e40d49 100644 --- a/nixos/modules/services/search/elasticsearch.nix +++ b/nixos/modules/services/search/elasticsearch.nix @@ -36,7 +36,8 @@ let postBuild = "${pkgs.coreutils}/bin/mkdir -p $out/plugins"; }; -in { +in +{ ###### interface @@ -116,20 +117,20 @@ in { extraCmdLineOptions = mkOption { description = "Extra command line options for the elasticsearch launcher."; - default = []; + default = [ ]; type = types.listOf types.str; }; extraJavaOptions = mkOption { description = "Extra command line options for Java."; - default = []; + default = [ ]; type = types.listOf types.str; example = [ "-Djava.net.preferIPv4Stack=true" ]; }; plugins = mkOption { description = "Extra elasticsearch plugins"; - default = []; + default = [ ]; type = types.listOf types.package; example = lib.literalExample "[ pkgs.elasticsearchPlugins.discovery-ec2 ]"; }; @@ -146,8 +147,8 @@ in { path = [ pkgs.inetutils ]; environment = { ES_HOME = cfg.dataDir; - ES_JAVA_OPTS = toString ( optional (!es6) [ "-Des.path.conf=${configDir}" ] - ++ cfg.extraJavaOptions); + ES_JAVA_OPTS = toString (optional (!es6) [ "-Des.path.conf=${configDir}" ] + ++ cfg.extraJavaOptions); } // optionalAttrs es6 { ES_PATH_CONF = configDir; }; From d58fa9e445d171ba8a735165dc60706d54e9cc4f Mon Sep 17 00:00:00 2001 From: happysalada Date: Wed, 1 Sep 2021 15:52:31 +0900 Subject: [PATCH 15/16] elasticsearch: fix jvm gc log path --- nixos/modules/services/search/elasticsearch.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix index e78ed7e40d49..ed566d978399 100644 --- a/nixos/modules/services/search/elasticsearch.nix +++ b/nixos/modules/services/search/elasticsearch.nix @@ -189,6 +189,9 @@ in cp ${loggingConfigFile} ${configDir}/${loggingConfigFilename} mkdir -p ${configDir}/scripts ${optionalString es6 "cp ${cfg.package}/config/jvm.options ${configDir}/jvm.options"} + # redirect jvm logs to the data directory + mkdir -m 0700 -p ${cfg.dataDir}/logs + ${pkgs.sd}/bin/sd 'logs/gc.log' '${cfg.dataDir}/logs/gc.log' ${configDir}/jvm.options \ if [ "$(id -u)" = 0 ]; then chown -R elasticsearch:elasticsearch ${cfg.dataDir}; fi ''; From 4ddc5c6b2addbf03ee21fa5b51de15b2cded11c8 Mon Sep 17 00:00:00 2001 From: happysalada Date: Tue, 31 Aug 2021 12:43:28 +0900 Subject: [PATCH 16/16] elasticsearch: remove logic for version less than 6 --- nixos/modules/services/search/elasticsearch.nix | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix index ed566d978399..440f34b3dc5c 100644 --- a/nixos/modules/services/search/elasticsearch.nix +++ b/nixos/modules/services/search/elasticsearch.nix @@ -5,8 +5,6 @@ with lib; let cfg = config.services.elasticsearch; - es6 = builtins.compareVersions cfg.package.version "6" >= 0; - esConfig = '' network.host: ${cfg.listenAddress} cluster.name: ${cfg.cluster_name} @@ -147,9 +145,7 @@ in path = [ pkgs.inetutils ]; environment = { ES_HOME = cfg.dataDir; - ES_JAVA_OPTS = toString (optional (!es6) [ "-Des.path.conf=${configDir}" ] - ++ cfg.extraJavaOptions); - } // optionalAttrs es6 { + ES_JAVA_OPTS = toString cfg.extraJavaOptions; ES_PATH_CONF = configDir; }; serviceConfig = { @@ -188,7 +184,7 @@ in rm -f "${configDir}/logging.yml" cp ${loggingConfigFile} ${configDir}/${loggingConfigFilename} mkdir -p ${configDir}/scripts - ${optionalString es6 "cp ${cfg.package}/config/jvm.options ${configDir}/jvm.options"} + cp ${cfg.package}/config/jvm.options ${configDir}/jvm.options # redirect jvm logs to the data directory mkdir -m 0700 -p ${cfg.dataDir}/logs ${pkgs.sd}/bin/sd 'logs/gc.log' '${cfg.dataDir}/logs/gc.log' ${configDir}/jvm.options \