17
NixOS and Lemmy (lemmy.world)
submitted 1 year ago* (last edited 1 year ago) by ericjmorey@lemmy.world to c/selfhosted@lemmy.world

Anyone with experience using NixOS to create a Lemmy instance, please share any caveats and troubleshooting tips you have.

you are viewing a single comment's thread
view the rest of the comments
[-] neoney@lemmy.neoney.dev 2 points 1 year ago

Nixpkgs is by nature fully reproducible and declarative - that means you can't write a nix package to just build from master branch. You also have to specify the sha256 hash to absolutely make sure the source is the same for everyone.
With flakes, it's a bit easier, because if the package you're trying to build has a flake, you can just update it in your own lockfile and it will be rebuilt from the latest version.
If using something from nixpkgs, you have to wait (or PR yourself) for someone to PR the update, or you can also use overrideAttrs to do a "private" fix.
For example, I'm using the wlsunset program, but wanted to build from a different branch, so I did this:

      (wlsunset.overrideAttrs (old: {
        src = fetchFromSourcehut {
          owner = "~kennylevinsen";
          repo = old.pname;
          rev = "81cfb0b4f8e44db9e5ecb36222a24d53a953e6aa";
          sha256 = "sha256-Lxuhsk4/5EHuKPkBbaRtCCQ/LFvIxyc+VQYEoaVT484=";
        };
      }))

This just changes the source attribute to another commit and another sha hash, and it works fine.

[-] neoney@lemmy.neoney.dev 1 points 1 year ago

In the end, the lag is just caused by the fact that it has to work. You never want to get some broken version that you want to avoid, so nix packages are always tested with the new versions, because it may turn out they may need some patching for that version, or they have some new dependencies.

this post was submitted on 13 Jun 2023
17 points (90.5% liked)

Selfhosted

39364 readers
733 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS