Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pleroma-otp: init at 2.2.2 #103138

Merged
merged 3 commits into from Jan 27, 2021
Merged

Pleroma-otp: init at 2.2.2 #103138

merged 3 commits into from Jan 27, 2021

Conversation

picnoir
Copy link
Member

@picnoir picnoir commented Nov 8, 2020

Motivation for this change

See #62820.

This PR provides:

  • A pleroma-otp package, the official pleroma binary distribution.
  • A pleroma NixOS module.
  • A NixOS manual entry explaining how to setup this module.
  • A NixOS VM test testing that module. (nix-build -A nixosTests.pleroma to run it).

Some random notes:

  • Using a binary distribution is far from ideal, however, building this Elixir project turned out being quite complex. pleroma-otp is just a starting point, it'd be nice to compile the project from scratch ourselves in the future.
  • The VM test required to patch the toot CLI. I'll try to upstream that patch. (Edit: login_cli: add TOOT_LOGIN_CLI_PASSWORD env variable ihabunek/toot#180)
  • My English spelling is generally pretty bad, please be as pedantic as you can while reviewing the pleroma manual entry.
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/successful-pleroma-configuration-example/9871/8

nixos/tests/pleroma.nix Outdated Show resolved Hide resolved
nixos/tests/pleroma.nix Outdated Show resolved Hide resolved
nixos/tests/pleroma.nix Outdated Show resolved Hide resolved
nixos/tests/pleroma.nix Outdated Show resolved Hide resolved
@picnoir
Copy link
Member Author

picnoir commented Nov 9, 2020

Thanks for the feedback.

Addressed and forced push.

@picnoir
Copy link
Member Author

picnoir commented Nov 11, 2020

Just forced push a fix for some issues I noticed:

  1. Add aarch64 support. It's a bindist, we need to fetch a different distribution dependending of the target arch (for x compilation). Thanks to Flokli for the help.
  2. Added a read-only option pointing to the state directory.
  3. Added a guard making sure we're running on a aarch64 or x86-64 system for the tests.

@ghost
Copy link

ghost commented Nov 12, 2020

Hey there, I'm running a source-built version of Pleroma since a few months. A binary version is already a big improvement, but also feel free to use my source-built version if you can make it fit:
https://git.petabyte.dev/petabyteboy/nixfiles/src/branch/master/pkgs/pleroma

@picnoir
Copy link
Member Author

picnoir commented Nov 12, 2020

Waaat, that's great news!

Can I cherry pick your source build and default to it instead of this pleroma bindist half measure?

I see v2.2.0 has just been released I'll bump that this weekend.

@ghost
Copy link

ghost commented Nov 13, 2020

I bumped my package to 2.2.0, but it's still running on Elixir 1.10, because it complained about import_config statements with Elixir 1.11 despite my config file not containing any (probably caused by elixir-lang/elixir@b227069).
It might be problematic to upstream my source-built package, because it relies on some unmaintained Elixir tooling that hasn't made its way to nixpkgs for a reason: For example it currently uses builtins.fetchGit, which will not work on Hydra. Someone would need to change mix2nix to prefetch the Git repositories, insert the hash into mix.nix and use fetchgit instead of builtins.fetchGit.
I'd be happy to make changes and take care of updating the Pleroma package in the future, but I'm not able to maintain the new Elixir tooling that would be required to add source-built Pleroma.

@picnoir picnoir changed the title Pleroma-otp: init at 2.1.2 Pleroma-otp: init at 2.2.0 Nov 14, 2020
@picnoir
Copy link
Member Author

picnoir commented Nov 14, 2020

Bumped the PR to pleroma latest 2.2.0 release.


Ack @petabyteboy . To be franc, I don't really have any personal use of the elixir/otp ecosystem outside of Pleroma. I'm not really willing to invest a lot of the little hobby time I have in this ecosystem for now.

Let's move on with the bindist for now and see if somebody is willing to improve the mix.nix situation.

I wish I discovered your repo sooner, it'd have been very helpful. I just posted a comment on #62820 pointing to your source build to help with discoverability (in the secret hope to trigger more interest in upstreaming that :) ).


Dear reader, feel free to review/test further this PR ;)

@JJJollyjim
Copy link
Member

Looks good to me, would love to see it merged :)

nixos/tests/pleroma.nix Outdated Show resolved Hide resolved
@picnoir picnoir changed the title Pleroma-otp: init at 2.2.0 Pleroma-otp: init at 2.2.1 Jan 3, 2021
bqv added a commit to bqv/rc that referenced this pull request Jan 7, 2021
@picnoir picnoir changed the title Pleroma-otp: init at 2.2.1 Pleroma-otp: init at 2.2.2 Jan 20, 2021
@picnoir
Copy link
Member Author

picnoir commented Jan 20, 2021

I'm not sure what happened on ofborg here. The x86 test & aarch64 tests ran successfully but the x86 pleroma-otp build seemed to have failed. It makes no sense to me: I'm running this PR on my Pleroma instance running on a x86 machine.


I've been running this PR for the last 3 months on my personal Pleroma instance without any issue. This PR also received an approval.

I'm going to merge merge this in a week from now. If you have any objections, do holler now.

@b123400
Copy link
Contributor

b123400 commented Jan 26, 2021

Hello, I just tried to build with the files and got an interesting error

building '/nix/store/mq7iw7yjpqqbs6pxihcqmx5jdzdc7gm7-download.drv'...

trying https://git.pleroma.social/pleroma/pleroma/-/jobs/175284/artifacts/download
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 55.9M  100 55.9M    0     0   9.7M      0  0:00:05  0:00:05 --:--:-- 12.4M
hash mismatch in fixed-output derivation '/nix/store/wivbhgbr5l9izc9nm13dch4b2qg7wk75-download':
  wanted: sha256:0z93qvyda5kh794svk00pgbzhm5pv663rjkzkwwb6sfk7f9287ir
  got:    sha256:1c6l04gga9iigm249ywwcrjg6wzy8iiid652mws3j9dnl71w2sim

nix-prefetch-url gives the same result:

# nix-prefetch-url https://git.pleroma.social/pleroma/pleroma/-/jobs/175284/artifacts/download
[55.9 MiB DL]
path is '/nix/store/wivbhgbr5l9izc9nm13dch4b2qg7wk75-download'
1c6l04gga9iigm249ywwcrjg6wzy8iiid652mws3j9dnl71w2sim

Can you confirm?

picnoir and others added 3 commits January 26, 2021 18:11
Co-authored-by: flokli <flokli@flokli.de>
Adding a new pleroma NixOS module and its associated documentation.

co-authored-by: duponin <duponin@locahlo.st>
@picnoir
Copy link
Member Author

picnoir commented Jan 26, 2021

Yup, I can confirm, thanks for the heads up!

I forgot or failed the copy paste while updating to 2.2.2 on x86_64. The FOD did not fail on my computer since I had 2.2.1 with the correct hash in my nix-store. Maybe Ofborg was failing because of hash mismatch in the end.

@b123400
Copy link
Contributor

b123400 commented Jan 27, 2021

Thank you! Looking forward to the merge :)

@picnoir picnoir merged commit ab224b5 into NixOS:master Jan 27, 2021
@picnoir picnoir deleted the nin-pleroma branch January 27, 2021 12:28
@happysalada
Copy link
Contributor

You might be interested to know that an initial effort has been started to package mix project.
#112477
It's not quite a mix nix, as it is a little more simplistic, but it should be available faster.
I wish I had known about this PR earlier, there are lots of interesting things, great work!

@happysalada happysalada mentioned this pull request Feb 20, 2021
10 tasks
@fgaz fgaz mentioned this pull request May 29, 2021
@ghost ghost mentioned this pull request Jun 6, 2021
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants