There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

yiliu ,

FWIW, I’m running NixOS but gave up on running the Lemmy module. I gave up when I realized that Lemmy seems to need superuser access to the Postgresql server, to install plugins or whatever.

So instead, I used Arion to make a docker-compose image, running in podman. Works great so far.

ericjmorey OP ,

Thanks for sharing your experience.

neoney ,
@neoney@lemmy.neoney.dev avatar

Oh hello, my instance is on NixOS!
There’s a NixOS module for lemmy, but it’s kind of broken right now and in the middle of a PR. If you want, you can replace the current nix package with the one from the fork, and successfully deploy it, however, if I were you, I’d just wait a week or so.

The configuration right now requires a bunch of hacks, and even doing some non-reproducible stuff.

ericjmorey OP ,

That PR link returns a 404.

This is my way of learning Nix/NixOS so I’d rather give it a go before the PR is merged.

neoney ,
@neoney@lemmy.neoney.dev avatar

Sorry, missed a character, try again

ericjmorey OP ,

I’m so deep in the weeds. I don’t know what questions to ask.

neoney ,
@neoney@lemmy.neoney.dev avatar

Okay, I’ve actually figured simplifying it out, it’s not that bad. Let me share my config:

First, since the PR isn’t in nixos-unstable yet, I’m adding the fork as a flake input

<pre style="background-color:#ffffff;">
<span style="color:#323232;">inputs = {
</span><span style="color:#323232;">  nixpkgs-lemmy.url = "github:CobaltCause/nixpkgs/lemmy-module-improvements";
</span><span style="color:#323232;">};
</span>

then, in my system configuration, I add this:

<pre style="background-color:#ffffff;">
<span style="color:#323232;"># Not sure if this is required, maybe caddy auto-allows it
</span><span style="color:#323232;">networking.firewall.interfaces.eth0.allowedTCPPorts = [443 80];
</span><span style="color:#323232;">
</span><span style="color:#323232;"># Override the lemmy module with the one from the PR
</span><span style="color:#323232;">disabledModules = ["services/web-apps/lemmy.nix"];
</span><span style="color:#323232;">imports = [
</span><span style="color:#323232;">  "${inputs.nixpkgs-lemmy}/nixos/modules/services/web-apps/lemmy.nix"
</span><span style="color:#323232;">];
</span><span style="color:#323232;">
</span><span style="color:#323232;">services.lemmy = {
</span><span style="color:#323232;">  database.createLocally = true;
</span><span style="color:#323232;">  database.uri = "postgres:///lemmy?host=/run/postgresql&user=lemmy";
</span><span style="color:#323232;">  enable = true;
</span><span style="color:#323232;">  settings = {
</span><span style="color:#323232;">    hostname = "<YOUR_HOSTNAME>";
</span><span style="color:#323232;">  };
</span><span style="color:#323232;">  caddy.enable = true;
</span><span style="color:#323232;">};
</span>

and, that’s it!
However, I’m not sure if it will cleanly deploy, as you might get an error while starting.
If so, please check postgresql logs sudo journalctl -fu postgresql. The error will most likely be something like this:
[…] [10289] ERROR: permission denied: “RI_ConstraintTrigger_a_16639” is a system trigger […]

If that happens, you need to manually run the migration until the fix is merged into Lemmy. Here’s how I did it:

  1. sudo su - postgres
  2. psql -v ON_ERROR_STOP=1 lemmy postgres
  3. (in psql) SET ROLE lemmy;
  4. Paste the SQL code from here: github.com/LemmyNet/lemmy/issues/2784#issuecommen…

After that’s done, you can exit the postgres CLI by typing q, exit the postgres user and just simply sudo systemctl restart lemmy which should start properly now, and be accessible to the outside network.
Open it and it will give you the initial setup screen. Good luck!

neoney ,
@neoney@lemmy.neoney.dev avatar

Note that the PR got merged into nixpkgs now, but hasn’t made it’s way forward (see nixpk.gs/pr-tracker.html?pr=236295), so that’s why you need to do the override for now Also, a fix for the issue with the migrations (if still occuring) has been merged yesterday, but it’s not in any release yet, and especially not in nixpkgs. You could most likely get around it by using overrideAttrs to change the source to make it build from a newer commit.

ericjmorey OP ,

Is this sort of lag the nature of package managers that will inherently be part of NixOS and nixpk?

neoney ,
@neoney@lemmy.neoney.dev avatar

While we were talking I updated lemmy-server using overrideAttrs for my own use. It’s honestly not that hard. You change the commit, specify some random incorrect hashes, build it, nix screams at you that the hash is incorrect (and generously provides the correct one), put the correct hash, and build again. Done.

ericjmorey OP ,

That kinda defeats the purpose of the hash.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines