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

pds: init at 0.4.67, nixos/pds: init #350645

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

Conversation

t4ccer
Copy link
Member

@t4ccer t4ccer commented Oct 23, 2024

Things done

Self hosted server for https://bsky.social/

  • 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: module (update) This PR changes an existing module in `nixos/` labels Oct 23, 2024
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 labels Oct 23, 2024
@h7x4 h7x4 added the 8.has: module (new) This PR adds a module in `nixos/` label Oct 24, 2024
@pyrox0
Copy link
Member

pyrox0 commented Oct 27, 2024

Upstream uses PNPM, why not use the existing PNPM tooling to generate the package? That means then there's no need to store an additional lockfile in-tree.

See https://nixos.org/manual/nixpkgs/stable/#javascript-pnpm for how to use nixpkgs' pnpm tooling.

Edit: I see your comment. Let me see if I can improve that for the pnpm tooling.

@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-ready-for-review/3032/4786

@soopyc
Copy link
Member

soopyc commented Nov 1, 2024

Upstream has updated to 0.4.67, you might want to consider updating.

@t4ccer t4ccer changed the title pds: init at 0.4.59, nixos/pds: init pds: init at 0.4.67, nixos/pds: init Nov 1, 2024
Copy link
Contributor

@BatteredBunny BatteredBunny left a comment

Choose a reason for hiding this comment

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

Small changes

nixos/modules/services/web-apps/pds.nix Outdated Show resolved Hide resolved
pkgs/by-name/pd/pds/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/pd/pds/package.nix Outdated Show resolved Hide resolved
@BatteredBunny
Copy link
Contributor

Managed to successfully deploy it to my server :)
Had to modify the pdsadmin scripts though https://github.com/BatteredBunny/pds

@t4ccer
Copy link
Member Author

t4ccer commented Nov 1, 2024

Yeah, I didn't bother packaging the admin scripts because the main one just fetches scripts for subcommands and they all have wrong shebang. Probably upstream should be fixed to use /usr/bin/env bash

Edit: opened a PR upstream bluesky-social/pds#121

@pyrox0
Copy link
Member

pyrox0 commented Nov 7, 2024

Yeah, I didn't bother packaging the admin scripts because the main one just fetches scripts for subcommands and they all have wrong shebang. Probably upstream should be fixed to use /usr/bin/env bash

Edit: opened a PR upstream bluesky-social/pds#121

You should also be able to run the patchShebangs script on the scripts. Does that work?

Copy link
Member

@pyrox0 pyrox0 left a comment

Choose a reason for hiding this comment

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

Nice work on the service, found a few nits though

nixos/modules/services/web-apps/pds.nix Outdated Show resolved Hide resolved
nixos/modules/services/web-apps/pds.nix Outdated Show resolved Hide resolved
nixos/modules/services/web-apps/pds.nix Outdated Show resolved Hide resolved
nixos/modules/services/web-apps/pds.nix Show resolved Hide resolved
nixos/modules/services/web-apps/pds.nix Outdated Show resolved Hide resolved
@pyrox0
Copy link
Member

pyrox0 commented Nov 7, 2024

Also, having looked into the sharp issue, I believe it's an issue with sharp being version 0.32.x, not 0.33.x, where there are now prebuilt binaries available. I'm looking into submitting a patch upstream to update this dependency

Edit: bluesky-social/atproto#2958

@t4ccer
Copy link
Member Author

t4ccer commented Nov 7, 2024

You should also be able to run the patchShebangs script on the scripts. Does that work?

Not really. It'll fix the main script but all it's doing is download subsequent ones that will still fail because they're not patched https://github.com/bluesky-social/pds/blob/main/pdsadmin.sh#L22-L30

Other way would be to patch the main script to use store path instead of downloading it but I wasn't sure if that's not too much change. But maybe that's a good idea to keep them locked to pds version

@pyrox0
Copy link
Member

pyrox0 commented Nov 7, 2024

You should also be able to run the patchShebangs script on the scripts. Does that work?

Not really. It'll fix the main script but all it's doing is download subsequent ones that will still fail because they're not patched bluesky-social/pds@main/pdsadmin.sh#L22-L30

Other way would be to patch the main script to use store path instead of downloading it but I wasn't sure if that's not too much change. But maybe that's a good idea to keep them locked to pds version

yeah I'd say vendor the scripts, you could even make a new pdsadmin script in-tree and replace the one in the repo with it if you want. Removing what's essentially curl | bash is a great idea in my book. Them being in the nix store is fine, since if you look at the history for the scripts folder, they're not really touched much.

@t4ccer t4ccer force-pushed the t4/pbs/init-0-4-59 branch 3 times, most recently from ac7f4dc to 2d67d86 Compare November 8, 2024 04:40
@t4ccer t4ccer marked this pull request as draft November 8, 2024 04:46
@t4ccer
Copy link
Member Author

t4ccer commented Nov 8, 2024

Hm ExecStart = getExe cfg.package; doesn't seem to work? I get

(pds)[1989597]: pds.service: Failed to execute /nix/store/w25c005jjb98frrvhd7bkwjqmnlrjg96-pds-0.4.67/bin/pds: Exec format error
(pds)[1989597]: pds.service: Failed at step EXEC spawning /nix/store/w25c005jjb98frrvhd7bkwjqmnlrjg96-pds-0.4.67/bin/pds: Exec format error

on my server

@t4ccer t4ccer force-pushed the t4/pbs/init-0-4-59 branch 2 times, most recently from 913a3a8 to 8cabcfb Compare November 8, 2024 04:53
@t4ccer
Copy link
Member Author

t4ccer commented Nov 8, 2024

Missing shebang 🙃

@t4ccer t4ccer marked this pull request as ready for review November 8, 2024 05:16
@t4ccer t4ccer requested a review from pyrox0 November 8, 2024 05:16
@t4ccer
Copy link
Member Author

t4ccer commented Nov 8, 2024

I'll add NixOS test when I'll have more time, deployed on my server and works fine

@t4ccer
Copy link
Member Author

t4ccer commented Nov 10, 2024

Now with freeform settings and NixOS test!

@t4ccer t4ccer force-pushed the t4/pbs/init-0-4-59 branch 2 times, most recently from a00d060 to d4bc1b1 Compare November 10, 2024 03:55
Copy link
Member

@soopyc soopyc left a comment

Choose a reason for hiding this comment

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

i personally still don't like the idea of switching package managers and maintaining an entirely different lockfile in-tree. this unnecessarily increases maintenance burden and i doubt r-ryantm knows how to update this automatically. please correct me if i am wrong.

otherwise, looks okay. remember to add a release note.

pkgs/by-name/pd/pds/package.nix Outdated Show resolved Hide resolved
nixos/modules/services/web-apps/pds.nix Outdated Show resolved Hide resolved
@pyrox0
Copy link
Member

pyrox0 commented Nov 10, 2024

i personally still don't like the idea of switching package managers and maintaining an entirely different lockfile in-tree. this unnecessarily increases maintenance burden and i doubt r-ryantm knows how to update this automatically. please correct me if i am wrong.

otherwise, looks okay. remember to add a release note.

r-ryantm definitely can't update this without an update script. however, the linked upstream pr in one of my comments should help resolve the issue of needing to switch from pnpm(though that still needs to be fully tested once upstream releases a new version of the pds)

@t4ccer
Copy link
Member Author

t4ccer commented Nov 10, 2024

r-ryantm definitely can't update this without an update script. however, the linked upstream pr in one of my comments should help resolve the issue of needing to switch from pnpm(though that still needs to be fully tested once upstream releases a new version of the pds)

Yep. The next bump will need to be manually and tested if new pnpm hook will work this time, if yes we can drop the lock file

@pyrox0
Copy link
Member

pyrox0 commented Nov 10, 2024

one last little nitpick, could there be an option to enable/disable adding the pdsadmin scripts to environment.systemPackages? just pds.pdsadmin.enable or something like that, and have it default to the same value as the pds.enable option. that way folks don't get confused about needing to add them separately.

@t4ccer
Copy link
Member Author

t4ccer commented Nov 10, 2024

pdsadmin is generally quite annoying because it needs environment variables from systemd to run correctly, let me see if we can generate a wrapper derived from settings

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 8.has: 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 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants