Commit graph

25763 commits

Author SHA1 Message Date
Maximilian Bosch 9f2b4357c1
postgresql: save rebuilds of existing packages
...by using `+ lib.optionalString ...` rather than a substitution. That
way the phases don't have additional trailing white-spaces in the
non-JIT case which cause rebuilds.
2023-03-29 08:39:47 +02:00
Maximilian Bosch a5a715bb24
postgresql_jit: fix darwin build
So, patchelf works on ELF files and these don't exist on Darwin. I'm not
aware of any other way to eliminate all references of the executable's
body while preserving library paths in the header. This still works, the
only problem is that darwin has a dependency on llvm.dev, so it's
runtime closure is larger.
2023-03-29 08:39:47 +02:00
Maximilian Bosch 43dbeae02d
postgresql: pass through JIT-enabled variant of non-JIT postgres and vice versa
This is useful if your postgresql version is dependant on
`system.stateVersion` and not pinned down manually. Then it's not
necessary to find out which version exactly is in use and define
`package` manually, but just stay with what NixOS provides as default:

    $ nix-instantiate -A postgresql
    /nix/store/82fzmb77mz2b787dgj7mn4a8i4f6l6sn-postgresql-14.7.drv
    $ nix-instantiate -A postgresql_jit
    /nix/store/qsjkb72fcrrfpsszrwbsi9q9wgp39m50-postgresql-14.7.drv
    $ nix-instantiate -A postgresql.withJIT
    /nix/store/qsjkb72fcrrfpsszrwbsi9q9wgp39m50-postgresql-14.7.drv
    $ nix-instantiate -A postgresql.withJIT.withoutJIT
    /nix/store/82fzmb77mz2b787dgj7mn4a8i4f6l6sn-postgresql-14.7.drv

I.e. you can use postgresql with JIT (for complex queries only[1]) like
this:

    services.postgresql = {
      enable = true;
      enableJIT = true;
    };

Performing a new override instead of re-using the `_jit`-variants for
that has the nice property that overlays for the original package apply
to the JIT-enabled variant, i.e.

    with import ./. {
      overlays = [
        (self: super: {
          postgresql = super.postgresql.overrideAttrs (_: { fnord = "snens"; });
        })
      ];
    };
    postgresql.withJIT.fnord

still gives the string `snens` whereas `postgresql_jit` doesn't have the
attribute `fnord` in its derivation.

[1] https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-JIT-ABOVE-COST
2023-03-29 08:39:46 +02:00
Maximilian Bosch 2282fa73a1
postgresql: implement opt-in JIT support
Closes #150801

Note: I decided against resuming directly on #150801 because the
conflict was too big (and resolving it seemed too error-prone to me).
Also the `this`-refactoring could be done in an easier manner, i.e. by
exposing JIT attributes with the correct configuration. More on that
below.

This patch creates variants of the `postgresql*`-packages with JIT[1]
support. Please note that a lot of the work was derived from previous
patches filed by other contributors, namely dasJ, andir and abbradar,
hence the co-authored-by tags below.

Effectively, the following things have changed:

* For JIT variants an LLVM-backed stdenv with clang is now used as
  suggested by dasJ[2]. We need LLVM and CLang[3] anyways to build the
  JIT-part, so no need to mix this up with GCC's stdenv. Also, using the
  `dev`-output of LLVM and clang's stdenv for building (and adding llvm
  libs as build-inputs) seems more cross friendly to me (which will
  become useful when cross-building for JIT-variants will actually be
  supported).

* Plugins inherit the build flags from the Makefiles in
  `$out/lib/pgxs/src` (e.g. `-Werror=unguarded-availability-new`). Since
  some of the flags are clang-specific (and stem from the use of the
  CLang stdenv) and don't work on gcc, the stdenv of `pkgs.postgresql`
  is passed to the plugins. I.e., plugins for non-JIT variants are built
  with a gcc stdenv on Linux and plugins for JIT variants with a clang
  stdenv.

  Since `plv8` hard-codes `gcc` as `$CC` in its Makefile[4], I marked it
  as broken for JIT-variants of postgresql only.

* Added a test-matrix to confirm that JIT works fine on each
  `pkgs.postgresql_*_jit` (thanks Andi for the original test in
  #124804!).

* For each postgresql version, a new attribute
  `postgresql_<version>_jit` (and a corresponding
  `postgresqlPackages<version>JitPackages`) are now exposed for better
  discoverability and prebuilt artifacts in the binary cache.

* In #150801 the `this`-argument was replaced by an internal recursion.
  I decided against this approach because it'd blow up the diff even
  more which makes the readability way harder and also harder to revert
  this if necessary.

  Instead, it is made sure that `this` always points to the correct
  variant of `postgresql` and re-using that in an additional
  `.override {}`-expression is trivial because the JIT-variant is
  exposed in `all-packages.nix`.

* I think the changes are sufficiently big to actually add myself as
  maintainer here.

* Added `libxcrypt` to `buildInputs` for versions <v13. While
  building things with an LLVM stdenv, these versions complained that
  the extern `crypt()` symbol can't be found. Not sure what this is
  exactly about, but since we want to switch to libxcrypt for `crypt()`
  usage anyways[5] I decided to add it. For >=13 it's not relevant
  anymore anyways[6].

* JIT support doesn't work with cross-compilation. It is attempted to
  build LLVM-bytecode (`%.bc` is the corresponding `make(1)`-rule) for
  each sub-directory in `backend/` for the JIT apparently, but with a
  $(CLANG) that can produce binaries for the build, not the host-platform.

  I managed to get a cross-build with JIT support working with
  `depsBuildBuild = [ llvmPackages.clang ] ++ buildInputs`, but
  considering that the resulting LLVM IR isn't platform-independent this
  doesn't give you much. In fact, I tried to test the result in a VM-test,
  but as soon as JIT was used to optimize a query, postgres would
  coredump with `Illegal instruction`.

A common concern of the original approach - with llvm as build input -
was the massive increase of closure size. With the new approach of using
the LLVM stdenv directly and patching out references to the clang drv in
`$out` the effective closure size changes are:

    $ nix path-info -Sh $(nix-build -A postgresql_14)
    /nix/store/kssxxqycwa3c7kmwmykwxqvspxxa6r1w-postgresql-14.7	306.4M
    $ nix path-info -Sh $(nix-build -A postgresql_14_jit)
    /nix/store/xc7qmgqrn4h5yr4vmdwy56gs4bmja9ym-postgresql-14.7	689.2M

Most of the increase in closure-size stems from the `lib`-output of
LLVM

    $ nix path-info -Sh /nix/store/5r97sbs5j6mw7qnbg8nhnq1gad9973ap-llvm-11.1.0-lib
    /nix/store/5r97sbs5j6mw7qnbg8nhnq1gad9973ap-llvm-11.1.0-lib	349.8M

which is why this shouldn't be enabled by default.

While this is quite much because of LLVM, it's still a massive
improvement over the simple approach of adding llvm/clang as
build-inputs and building with `--with-llvm`:

    $ nix path-info -Sh $(nix-build -E '
	with import ./. {};
	postgresql.overrideAttrs ({ configureFlags ? [], buildInputs ? [], ... }: {
	  configureFlags = configureFlags ++ [ "--with-llvm" ];
	  buildInputs = buildInputs ++ [ llvm clang ];
	})' -j0)
    /nix/store/i3bd2r21c6c3428xb4gavjnplfqxn27p-postgresql-14.7	  1.6G

Co-authored-by: Andreas Rammhold <andreas@rammhold.de>
Co-authored-by: Janne Heß <janne@hess.ooo>
Co-authored-by: Nikolay Amiantov <ab@fmap.me>

[1] https://www.postgresql.org/docs/current/jit-reason.html
[2] https://github.com/NixOS/nixpkgs/pull/124804#issuecomment-864616931
    & https://github.com/NixOS/nixpkgs/pull/150801#issuecomment-1467868321
[3] This fails with the following error otherwise:
    ```
    configure: error: clang not found, but required when compiling --with-llvm, specify with CLANG=
    ```
[4] https://github.com/plv8/plv8/blob/v3.1.5/Makefile#L14
[5] https://github.com/NixOS/nixpkgs/pull/181764
[6] c45643d618
2023-03-29 08:39:46 +02:00
Sandro 46c5c6e90f
Merge pull request #221067 from r-ryantm/auto-update/minio
minio: 2023-02-27T18-10-45Z -> 2023-03-13T19-46-17Z
2023-03-23 11:07:21 +01:00
Maximilian Bosch 0076d2a5c5
Merge pull request #222615 from Ma27/bump-grafana
grafana: 9.4.3 -> 9.4.7
2023-03-23 07:23:13 +01:00
Nick Cao 9b1b875591
Merge pull request #222574 from pzeinlinger/master
headscale: 0.20.0 -> 0.21.0
2023-03-23 13:21:09 +08:00
Sandro 17ebff1691
Merge pull request #220190 from techknowlogick/consul-115 2023-03-23 01:12:34 +01:00
figsoda c2c1640140
Merge pull request #222503 from NickCao/traefik
traefik: 2.9.8 -> 2.9.9
2023-03-22 18:39:57 -04:00
Maximilian Bosch c042a318a7
Merge pull request #222372 from NixOS/nextcloud26
nextcloud26: init at 26.0.0
2023-03-22 23:35:31 +01:00
Maximilian Bosch 841417745c
grafana: 9.4.3 -> 9.4.7
Sadly, upstream doesn't publish proper changelogs anymore[1] and there's
also quite a gap - this is the first time a release was published for
9.4.x since 9.4.3, so I decided to skim through the commit log on my own[2].

While there are no apparent problematic changes for us, but only
bugfixes, internal changes and a few doc fixes, I found at least one
security patch[3] fixing XSS in the graphite datasource settings, hence
the corresponding PR will get a security label.

[1] https://github.com/grafana/grafana/releases/tag/v9.4.7
    / adcdf190bb
[2] https://github.com/grafana/grafana/compare/v9.4.3...v9.4.7
[3] ef2eb2b6bf
2023-03-22 23:28:30 +01:00
Maximilian Bosch 6a0b0a5de9 nextcloud: remove compat references to v23
This is not needed anymore because the version is EOL for almost a year
now and we don't even have the packages anymore, only the attributes for
compatibility for upgrades from older NixOS versions.
2023-03-22 22:37:17 +01:00
Raito Bezarius dd96b7d8b4 nextcloud26, nixos/web-apps/nextcloud: drop the autocreate db user patch and wire the default in the NixOS module 2023-03-22 22:37:16 +01:00
Paul Zeinlinger d815460b54 headscale: 0.20.0 -> 0.21.0 2023-03-22 18:44:26 +01:00
Nick Cao 47b07796b4
traefik: 2.9.8 -> 2.9.9
Diff: https://github.com/traefik/traefik/compare/v2.9.8...v2.9.9

Changelog: https://github.com/traefik/traefik/raw/v2.9.9/CHANGELOG.md
2023-03-22 16:35:16 +08:00
Mario Rodas 9a2e14a323
Merge pull request #222453 from marsam/update-pgvector
postgresqlPackages.pgvector: 0.4.0 -> 0.4.1
2023-03-22 02:39:59 -05:00
Mario Rodas b63385ad1f
Merge pull request #222434 from SuperSandro2000/SuperSandro2000-patch-1
postgresqlPackages.pg_repack: use clickable homepage
2023-03-21 20:49:48 -05:00
Sandro ffe1c9dc0f
postgresqlPackages.pg_repack: use clickable homepage 2023-03-22 00:03:59 +01:00
Vaci e400f93529
aeron: init at 1.40.0 (#191663)
Co-authored-by: Vaci Koblizek <vaci.koblizek@auguration.com>
2023-03-21 19:59:14 +01:00
Raito Bezarius 2f9c4a7e74 nextcloud24Packages: update at various 2023-03-21 16:49:27 +01:00
Raito Bezarius 9a33d7d9db nextcloud25Packages: update at various 2023-03-21 16:49:19 +01:00
Raito Bezarius 1eddc824e2 nextcloud26Packages: init at various 2023-03-21 16:49:10 +01:00
Raito Bezarius 109166f87e nextcloud26: init at 26.0.0 2023-03-21 16:41:47 +01:00
Mario Rodas 625cfdd6b5
Merge pull request #222249 from phile314/slimserver-rm-maintainer-phile314
slimserver: remove phile314 as maintainer
2023-03-21 06:09:42 -05:00
ajs124 2b387af207
Merge pull request #221343 from helsinki-systems/upd/proxysql
proxysql: 2.5.0 -> 2.5.1
2023-03-21 11:58:22 +01:00
Stanisław Pitucha 4807f64975
Merge pull request #222293 from viraptor/rustypaste-darwin
rustypaste: fix darwin build
2023-03-21 19:59:39 +11:00
Weijia Wang 4af0426bba
Merge pull request #222149 from wegank/limesurvey-bump
limesurvey: 3.27.33+220125 -> 5.6.9+230306
2023-03-21 08:52:42 +02:00
Stanisław Pitucha 220cd93919 rustypaste: fix darwin build 2023-03-21 16:15:37 +11:00
Mario Rodas 8a449b274a postgresqlPackages.pgvector: 0.4.0 -> 0.4.1 2023-03-21 04:20:00 +00:00
Sandro 680e4d75b0
Merge pull request #222006 from mdarocha/remove-baget 2023-03-21 01:39:54 +01:00
Sandro 56c62c8ffb
Merge pull request #221709 from Izorkin/update-mastodon 2023-03-21 00:46:14 +01:00
Martin Weinelt 88bd1e59f8
Merge pull request #222216 from mweinelt/arrrrrrrrr
sonarr: 3.0.9.1549 -> 3.0.10.1567
2023-03-20 22:16:05 +00:00
Philipp Hausmann 88c4a670e6 slimserver: remove phile314 as maintainer 2023-03-20 20:59:23 +01:00
Izorkin e0371f9d20
mastodon: 4.1.0 -> 4.1.1 2023-03-20 21:47:01 +03:00
Yureka 2676c648ea
fastnetmon-advanced: init at 2.0.335 (#218609) 2023-03-20 18:22:53 +01:00
Martin Weinelt 9180097c41
sonarr: 3.0.9.1549 -> 3.0.10.1567 2023-03-20 16:30:13 +01:00
Weijia Wang b64eb5bbbf limesurvey: 3.27.33+220125 -> 5.6.9+230306 2023-03-20 14:31:32 +02:00
Mario Rodas 92f8db870c redis: 7.0.9 -> 7.0.10
Security Fixes:

- (CVE-2023-28425) Specially crafted MSETNX command can lead to assertion and denial-of-service

https://github.com/redis/redis/releases/tag/7.0.10
2023-03-20 04:20:00 +00:00
Martin Weinelt 8b7b6bac2c
Merge pull request #221650 from mweinelt/synadm-0.40
matrix-synapse.tools.synadm: 0.38 -> 0.40
2023-03-21 17:09:06 +01:00
Weijia Wang afc54d3cad
Merge pull request #221945 from r-ryantm/auto-update/komga
komga: 0.163.0 -> 0.164.0
2023-03-20 00:47:22 +02:00
Weijia Wang 63829f0f13
Merge pull request #222025 from peat-psuwit/zoneminder-1.36.33
zoneminder: 1.36.32 -> 1.36.33, replace /bin/rm with Nix path
2023-03-20 00:21:08 +02:00
Sandro 9a538bfe4a
Merge pull request #221188 from lucasew/cockpit/bump-287 2023-03-19 22:38:37 +01:00
Sandro be3a64375b
Merge pull request #221769 from r-ryantm/auto-update/onlyoffice-documentserver 2023-03-19 21:23:21 +01:00
Nikolay Korotkiy 7f55ff0b21
Merge pull request #222024 from sikmir/agate
agate: 3.2.4 → 3.3.0
2023-03-19 19:55:40 +04:00
Nikolay Korotkiy 832a6df04c
agate: 3.2.4 → 3.3.0 2023-03-19 18:34:32 +04:00
Ratchanan Srirattanamet 2a6fe23bac zoneminder: replace /bin/rm with Nix path
This fixes running zmaudit.pl, among others.
2023-03-19 14:16:57 +00:00
Ratchanan Srirattanamet 630cbf639d zoneminer: 1.36.32 -> 1.36.33 2023-03-19 20:35:21 +07:00
mdarocha 4062f28a76 baget: remove due to upstream being unmaintained 2023-03-19 14:19:49 +01:00
Nikolay Korotkiy b58639c0bf
Merge pull request #221702 from sikmir/nanomq
nanomq: 0.15.5 → 0.16.3
2023-03-19 16:41:42 +04:00
Ilan Joselevich 9625629f56
tailscale: reduce closure size via ldflags 2023-03-19 13:18:16 +02:00