Skip to content

Conversation

tetov
Copy link
Contributor

@tetov tetov commented May 30, 2025

I started this PR with the intent to expose host and port as their own options but after going through similar modules I found that that is not typically done. I had already written a test and done some refactoring so I decided to open a PR anyways.

  • Added a nixos test which mainly targets environment variables HOST and PORT.
    No non graphical way to generate api token found so not sure how to test more.

  • Changed how the systemd environment is constructed using attribute merging

  • environmentFiles added to replace environmentFile, which is hidden but still
    supported (with a deprecation warning). This fits well with how the env file
    generated in the init service unit is added to web and workers.

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/)
  • Nixpkgs 25.11 Release Notes (or backporting 24.11 and 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 24.11 and 25.05 NixOS Release notes)
    • (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: module (update) This PR changes an existing module in `nixos/` 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 May 30, 2025
@tetov tetov requested a review from three May 30, 2025 17:08
@tetov
Copy link
Contributor Author

tetov commented May 30, 2025

Requested review from module and package maintainer @three.

@tetov
Copy link
Contributor Author

tetov commented May 30, 2025

@ofborg test karakeep

Copy link
Contributor

@three three left a comment

Choose a reason for hiding this comment

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

I appreciate the cleanup! I did have a question about how setting services.karakeep.environmentFiles from within the module works. Otherwise this looks good.

@tetov
Copy link
Contributor Author

tetov commented Jun 6, 2025

I did have a question about how setting services.karakeep.environmentFiles from within the module works.

I found this behavior in another module, I'll try to find it. I thought it made sense to use the default behavior of option merging :).

EDIT:

@tetov
Copy link
Contributor Author

tetov commented Jun 9, 2025

Sorry for quite a big commit. It might be good to check the diff ignoring whitespace since indentation changed. Some notes:

DATA_DIR is protected as it is set to read-only:

error: The option `nodes.karakeep_server.services.karakeep.extraEnvironment.DATA_DIR' is read-only, but it's set multiple times. Definition values:
- In `/nix/store/AAA-source/nixos/modules/services/web-apps/karakeep.nix': "/var/lib/karakeep"
- In `/nix/store/AAA-source/nixos/tests/web-apps/karakeep.nix': "/something/else"

environmentFile is now deprecated properly, it gives a warning but still works (by turning the value into a list and assigning to environmentFiles):

evaluation warning: The option `services.karakeep.environmentFile' defined in `/nix/store/AAA-source/nixos/tests/web-apps/karakeep.nix' has been changed to `services.karakeep.environmentFiles' that has a different type. Please read `services.karakeep.environmentFiles' documentation and update your configuration accordingly.

@tetov
Copy link
Contributor Author

tetov commented Jun 9, 2025

I need to add descriptions to all options, I'll do that today.

@HritwikSinghal
Copy link
Contributor

Hi @tetov , karakeep 0.25.0 just got released. Can you also update the pkg to latest version if you know how its nix packaging works?

@HritwikSinghal
Copy link
Contributor

Hi @tetov , karakeep 0.25.0 just got released. Can you also update the pkg to latest version if you know how its nix packaging works?

cc @three

@tetov
Copy link
Contributor Author

tetov commented Jun 9, 2025

@HritwikSinghal, @three:

I'll update it, no problem. I want to do it in a separate PR though.

Also, I'm preparing another PR targeting the package to fix the process trying to write to .next/cache in /nix/store..

But let's keep it module focused in this one :).

@tetov tetov requested a review from three June 11, 2025 12:28
@tetov
Copy link
Contributor Author

tetov commented Jun 13, 2025

@HritwikSinghal: #416487 :)

@HritwikSinghal
Copy link
Contributor

Also, I'm preparing another PR targeting the package to fix the process trying to write to .next/cache in /nix/store..

I also saw this error but don't know much about nextJS so couldn't solve it. can you link the PR here once you figure out the fix. will help me learn something new :)

@HritwikSinghal: #416487 :)

Thanks :)

@tetov tetov mentioned this pull request Jun 13, 2025
13 tasks
@tetov tetov force-pushed the karakeep_module_host_port branch from 1a2876b to 1fb8851 Compare June 15, 2025 18:17
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 15, 2025
@github-actions github-actions bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jun 15, 2025
@tetov tetov force-pushed the karakeep_module_host_port branch from 1fb8851 to 1525adb Compare June 15, 2025 18:29
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 15, 2025
@HritwikSinghal
Copy link
Contributor

HritwikSinghal commented Jun 15, 2025

getting this error after upgrading from prev versions.

[hritwik@karakeep:~]$ journalctl -feu meilisearch.service
Jun 15 22:35:49 karakeep systemd[1]: Started MeiliSearch daemon.
Jun 15 22:35:49 karakeep meilisearch[314]: 2025-06-15T17:05:49.659665Z ERROR meilisearch: error=Your database version (1.14.0) is incompatible with your current engine version (1.15.2).
Jun 15 22:35:49 karakeep meilisearch[314]: To migrate data between Meilisearch versions, please follow our guide on https://www.meilisearch.com/docs/learn/update_and_migration/updating.
Jun 15 22:35:49 karakeep meilisearch[314]: Error: Your database version (1.14.0) is incompatible with your current engine version (1.15.2).
Jun 15 22:35:49 karakeep meilisearch[314]: To migrate data between Meilisearch versions, please follow our guide on https://www.meilisearch.com/docs/learn/update_and_migration/updating.
Jun 15 22:35:49 karakeep systemd[1]: meilisearch.service: Main process exited, code=exited, status=1/FAILURE
Jun 15 22:35:49 karakeep systemd[1]: meilisearch.service: Failed with result 'exit-code'.
Jun 15 22:35:49 karakeep systemd[1]: meilisearch.service: Consumed 19ms CPU time, 15.1M memory peak, 43.1M read from disk.

@tetov can you add services.karakeep.meilisearch.dumplessUpgrade option to this module which would just change value of services.meilisearch.dumplessUpgrade . this would fix the upgrade issues.

i've tested this on my machine and setting services.meilisearch.dumplessUpgrade = true; solves the issue.

docs for the same: https://www.meilisearch.com/docs/learn/update_and_migration/updating#dumpless-upgrade
karakeep discussion on this: karakeep-app/karakeep#1333

@tetov
Copy link
Contributor Author

tetov commented Jun 15, 2025

Thanks for reporting @HritwikSinghal. I'm unsure if I should add more to this PR or make that another. I have prepared a branch that I can either merge into this one or use in a new PR.

https://github.com/tetov/nixpkgs/tree/karakeep_dumpless

@three: What's your take? Also, I'd be happy to be co-maintainer if you would like that.

@tetov

This comment was marked as resolved.

@tetov tetov mentioned this pull request Jun 19, 2025
13 tasks
@HritwikSinghal HritwikSinghal added 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Jul 17, 2025
@nixpkgs-ci nixpkgs-ci bot removed 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Jul 17, 2025
@mdaniels5757
Copy link
Contributor

@ofborg build karakeep karakeep.passthru.tests

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/prs-already-reviewed/2617/2470

@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 26, 2025
tetov added 3 commits August 6, 2025 14:38
- Added a nixos test which mainly targets environment variables HOST and PORT.
  No non graphical way to generate api token found so not sure how to test more.

- Changed how the systemd environment is constructed using attribute merging

- environmentFiles added to replace environmentFile, which is hidden but still
  supported (with a deprecation warning). This fits well with how the env file
  generated in the init service unit is added to web and workers.
DATA_DIR is protected as it is set to read-only:

error: The option `nodes.karakeep_server.services.karakeep.extraEnvironment.DATA_DIR' is read-only, but it's set multiple times. Definition values:
- In `/nix/store/AAA-source/nixos/modules/services/web-apps/karakeep.nix': "/var/lib/karakeep"
- In `/nix/store/AAA-source/nixos/tests/web-apps/karakeep.nix': "/something/else"

environmentFile is now deprecated properly, it gives a warning but still works (by turning the value into a list and assigning to environmentFiles):

evaluation warning: The option `services.karakeep.environmentFile' defined in `/nix/store/AAA-source/nixos/tests/web-apps/karakeep.nix' has been changed to `services.karakeep.environmentFiles' that has a different type. Please read `services.karakeep.environmentFiles' documentation and update your configuration accordingly.
@tetov tetov force-pushed the karakeep_module_host_port branch from 1525adb to 36108e9 Compare August 6, 2025 12:41
@tetov
Copy link
Contributor Author

tetov commented Aug 6, 2025

Fixed merge conflict.

@nixpkgs-ci nixpkgs-ci bot added 2.status: merge conflict This PR has merge conflicts with the target branch and removed 2.status: merge conflict This PR has merge conflicts with the target branch labels Aug 6, 2025
@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Aug 25, 2025
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 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 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. 12.approvals: 1 This PR was reviewed and approved by one person.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants