Skip to content

nixos/linkwarden: init module, linkwarden: init at 2.11.5 #347353

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jvanbruegge
Copy link
Contributor

Linkwarden is a self-hosted bookmarks manager: https://linkwarden.app/

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.11 Release Notes (or backporting 23.11 and 24.05 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.

@github-actions github-actions bot added 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 Oct 8, 2024
@jvanbruegge jvanbruegge force-pushed the linkwarden branch 2 times, most recently from 53fb536 to 73ed656 Compare October 8, 2024 21:36
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Oct 8, 2024
@jvanbruegge jvanbruegge force-pushed the linkwarden branch 3 times, most recently from c68a697 to 75c84ce Compare October 9, 2024 14:27
@h7x4 h7x4 added 8.has: module (new) This PR adds a module in `nixos/` 8.has: tests This PR has tests labels Oct 10, 2024
@jvanbruegge jvanbruegge mentioned this pull request Oct 25, 2024
13 tasks
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 1, 2024
@jvanbruegge jvanbruegge force-pushed the linkwarden branch 2 times, most recently from 3df49a6 to aa7a032 Compare November 13, 2024 23:13
@jvanbruegge
Copy link
Contributor Author

I've updated this PR now to the new version of linkwarden which does not need patching any more (all my PRs have been merged)

@jvanbruegge jvanbruegge removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 13, 2024
@jvanbruegge
Copy link
Contributor Author

Just updated my own linkwarden instance and everything works as expected

@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 14, 2024
@jvanbruegge jvanbruegge removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 14, 2024
@jvanbruegge jvanbruegge changed the title nixos/linkwarden: init module, linkwarden: init at 2.7.1 nixos/linkwarden: init module, linkwarden: init at 2.8.1 Nov 14, 2024
@jvanbruegge jvanbruegge force-pushed the linkwarden branch 2 times, most recently from cc46f2a to f0809e9 Compare July 22, 2025 10:32
@jvanbruegge jvanbruegge changed the title nixos/linkwarden: init module, linkwarden: init at 2.11.4 nixos/linkwarden: init module, linkwarden: init at 2.11.5 Jul 22, 2025
@jvanbruegge
Copy link
Contributor Author

Updated to version 2.11.5

@litchipi
Copy link
Contributor

litchipi commented Jul 30, 2025

Tested the module, it seams to work OK (thanks for the amazing work ❤️ )
However I have troubles when first setting up the service:

  • I do not have registration enabled, as I don't want anyone on the internet to create accounts on my server
  • But no base account are generated during initialisation.

One quick fix would be to enable temporarily the registration, and disable it later on.
Would there be a nix way to declaratively ensure users exist, with a specific passwordFile ?

EDIT:
In the service initialisation, if we launch Linkwarden with registration enabled, and iterate through the map of users to create, we can talk with the API endpoint to ensure they exist, and create them if they don't.
I don't really like this hack as I think it would be better done upstream, but should work enough

@jvanbruegge
Copy link
Contributor Author

Yes, something like that should be done upstream, not in this module. One other workaround is to just use OIDC instead of the builtin user management (that's what I use)

@jhol
Copy link
Contributor

jhol commented Aug 10, 2025

I just retested the module on my machine. In my setup, secrets are stored in sops-nix, and I use Authelia for OIDC. The module seems to be working perfectly!

services.linkwarden = {
  enable = true;

  environment = {
    NEXT_PUBLIC_AUTHELIA_ENABLED = "true";
    NEXTAUTH_URL = "https://linkwarden.${publicDomain}/api/v1/auth";
    AUTHELIA_WELLKNOWN_URL = "https://authelia.${publicDomain}/.well-known/openid-configuration";
    AUTHELIA_CLIENT_ID = oidc_clients.linkwarden.client_id;
    AUTHELIA_CLIENT_SECRET = oidc_clients.linkwarden.secret_password;
  };

  secretFiles = {
    POSTGRES_PASSWORD = config.sops.secrets."linkwarden/postgres_password".path;
    NEXTAUTH_SECRET = config.sops.secrets."linkwarden/nextauth_secret".path;
  };
};

@jvanbruegge
Copy link
Contributor Author

@drupol I have addressed all review comments

@jvanbruegge
Copy link
Contributor Author

Something seems to be wrong with ofborg, I can build and run the PR just fine.
Yeah, the error looks unrelated:

       error: cannot open connection to remote store 'daemon': error: reading from file: Connection reset by peer

@jvanbruegge
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 347353
Commit: e95e49ce7ef4b0ab9018554cf272e4990eeb7bde


x86_64-linux

⏩ 2 packages blacklisted:
  • nixos-install-tools
  • tests.nixos-functions.nixos-test
❌ 1 package failed to build:
  • documenso
✅ 4 packages built:
  • ghostfolio
  • linkwarden
  • pingvin-share.backend
  • prisma

Error logs: `x86_64-linux`
documenso
./pages/api/documents/[id]/send.ts:45:29
Type error: Parameter 'recipient' implicitly has an 'any' type.

43 |
44 | let sentRequests = 0;

45 | recipients.forEach(async (recipient) => {
| ^
46 | await sendSigningRequest(recipient, document, user).catch((err) => {
47 | console.log(err);
48 | return res.status(502).end("Coud not send request for signing.");
info - Linting and checking validity of types ...
ERROR: npm build failed

Here are a few things you can try, depending on the error:

  1. Make sure your build script (build) exists
    If there is none, set dontNpmBuild = true.
  2. If the error being thrown is something similar to "error:0308010C:digital envelope routines::unsupported", add NODE_OPTIONS = "--openssl-legacy-provider" to your derivation
    See nodejs 17: digital envelope routines::unsupported webpack/webpack#14532 for more information.

Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

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

Last thing, can you add a nixos release note entry? Then we can merge this.

@jvanbruegge
Copy link
Contributor Author

I added one now. I was not sure as the 25.11 release notes file did not have the "New modules" sections so I thought the release notes might no longer show new modules

@jvanbruegge
Copy link
Contributor Author

Ok, that just fails. Where am I supposed to add to the release notes? The "other notable changes section"?

@nixpkgs-ci nixpkgs-ci bot added the 8.has: changelog This PR adds or changes release notes label Aug 13, 2025
@MatthieuBarthel
Copy link
Member

@jvanbruegge
Copy link
Contributor Author

oh weird, why are those (partially) duplicated?

@MatthieuBarthel
Copy link
Member

I'm not sure why but I guess the final page is generated from partials. Thanks for the work, I'm running the module for a few months without any issue 👍

EnvironmentFile = cfg.environmentFile;
StateDirectory = "linkwarden";
CacheDirectory = "linkwarden";
User = cfg.user;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it mandatory to create a specific user? Can't we use dynamicUser instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Linkwarden saves a bunch of files to disk (ie the saved web pages). If you want to use a separate service to back up those files, wouldn't DynamicUser mess up file permissions?

Copy link
Contributor

Choose a reason for hiding this comment

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

Mmmh to be tested I would say? I don't think you should create a specific user for the backup, if you're able to run the service with dynamicUser, do it and we'll deal with potential backup later. Using dynamicUser should simplify the config too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: module (new) This PR adds a module in `nixos/` 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: package (new) This PR adds a new package 8.has: tests This PR has tests 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.