Skip to content

parsedmarc: fix and switch to OpenSearch - #285840

Closed
talyz wants to merge 4 commits into
NixOS:masterfrom
talyz:parsedmarc-fix-and-opensearch
Closed

talyz wants to merge 4 commits into
NixOS:masterfrom
talyz:parsedmarc-fix-and-opensearch

Conversation

@talyz

@talyz talyz commented Feb 2, 2024

Copy link
Copy Markdown
Contributor

Description of changes

Problems

parsedmarc has been broken for a while now, due to incompatible updates of the Elasticsearch python packages. This probably wasn't very obvious to anyone as the tests require allowUnfree, since Elasticsearch is no longer open source.

Solutions

  • Fix the broken python dependencies by pinning compatible ones
  • Switch from Elasticsearch to OpenSearch

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

parsedmarc has been broken for a while, since the elasticsearch python
packages were upgraded past its supported versions. To fix this, pin
the versions locally.
@talyz
talyz requested review from dotlambda and fabaff February 2, 2024 16:58
@github-actions github-actions Bot added 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation This PR adds or changes documentation 8.has: changelog This PR adds or changes release notes 8.has: module (update) This PR changes an existing module in `nixos/` labels Feb 2, 2024
@ofborg ofborg Bot added 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Feb 2, 2024
@@ -1,3 +1,24 @@
{ pythonPackages }:
let
packages = pythonPackages.overrideScope (final: prev: {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't override within pythonPackages.
Should we set meta.broken = true if the elasticsearch or elasticsearch-dsl version is too high? I assume most of the Python API still works.
We can override the package in all-packages.nix or in the NixOS module.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that? It works just fine and seems to be done in a few packages already.

Maybe? I don't use it any other way than as a server.

Overriding in all-packages.nix feels like a definite anti-pattern, since it means what you're seeing in the package file isn't what you expect. The sane alternative I can think of is to create new packages with the version pinned, but that seemed a bit unnecessary for just one package.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that? It works just fine and seems to be done in a few packages already.

You cannot have two versions of a Python module in the same environment. That could happen if parsedmarc is used together with another module that uses the elasticsearch module.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, we can never package multiple versions of the same python module, but this is at least already done for django. Overriding is also already done in other python modules. Overriding in the NixOS module is really bad for maintainability. Doing it in all-packages.nix (which isn't even used, currently) would be even worse. I would rather move it out of pythonPackages if so. No other package depends on parsedmarc - it's only used by the NixOS module.

However, I'm very doubtful this is even a real concern. In reality, you wouldn't be able to have your project depend on both parsedmarc and the latest version of elasticsearch at the same time, since parsedmarc restricts the version to the one I'm pinning here. Since elasticsearch has changed enough that parsedmarc is now broken with the latest version, any other module targeting the same version of it would likely also be broken the same way. So, in essence we would be optimizing for the opportunity of building broken environments.

@talyz
talyz force-pushed the parsedmarc-fix-and-opensearch branch from 25979c5 to b5db61e Compare February 5, 2024 12:27
@talyz talyz mentioned this pull request Feb 19, 2024
3 of 13 tasks
Switch to OpenSearch, an open source and compatible fork of
Elasticsearch, as the default locally deployed search engine. This
means it's once again possible to run parsedmarc without unfree
packages and the tests should therefore run in CI.
An incomplete implementation which left out null values was added in
NixOS#246992. Complete it by adding
the missing check.
@talyz
talyz force-pushed the parsedmarc-fix-and-opensearch branch from b5db61e to cac2a81 Compare February 19, 2024 17:32
@anthonyroussel anthonyroussel added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 25, 2024
@e1mo e1mo mentioned this pull request Mar 28, 2024
4 of 13 tasks
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 2, 2025
@talyz talyz closed this Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: python Python is a high-level, general-purpose programming language. 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants