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

nixos/piped: init module #317817

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

nixos/piped: init module #317817

wants to merge 4 commits into from

Conversation

Defelo
Copy link
Member

@Defelo Defelo commented Jun 6, 2024

Description of changes

Piped is an alternative privacy-friendly YouTube frontend which is efficient by design.

This pull request adds packages for the Piped frontend, backend and proxy, as well as a NixOS module for setting up a Piped instance.

Homepage: https://github.com/TeamPiped/Piped/

Closes #270008

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.

@Defelo
Copy link
Member Author

Defelo commented Jun 6, 2024

Result of nixpkgs-review pr 317817 run on x86_64-linux 1

1 package blacklisted:
  • nixos-install-tools
3 packages built:
  • piped
  • piped-backend
  • piped-proxy

@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/4084

Copy link
Contributor

@nbraud nbraud left a comment

Choose a reason for hiding this comment

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

Have some feedback, though the merge conflict also needs to be addressed

root = pkgs.runCommand "piped-frontend-patched" {} ''
cp -r ${cfg.frontend.package} $out
chmod -R +w $out
${pkgs.gnused}/bin/sed -i 's|https://pipedapi.kavin.rocks|${cfg.backend.externalUrl}|g' $out/{opensearch.xml,assets/*}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
${pkgs.gnused}/bin/sed -i 's|https://pipedapi.kavin.rocks|${cfg.backend.externalUrl}|g' $out/{opensearch.xml,assets/*}
${lib.getExe pkgs.gnused} -i 's|https://pipedapi.kavin.rocks|${cfg.backend.externalUrl}|g' $out/{opensearch.xml,assets/*}

or adding gnused to nativeBuildInputs

Comment on lines +209 to +213
root = pkgs.runCommand "piped-frontend-patched" {} ''
cp -r ${cfg.frontend.package} $out
chmod -R +w $out
${pkgs.gnused}/bin/sed -i 's|https://pipedapi.kavin.rocks|${cfg.backend.externalUrl}|g' $out/{opensearch.xml,assets/*}
'';
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems odd to do the rewriting in here. externalUrl could instead be a parameter for the piped package.

Comment on lines +45 to +70
host = lib.mkOption {
type = lib.types.str;
default = "127.0.0.1";
description = ''
The database host Piped should use.
'';
};

port = lib.mkOption {
type = lib.types.port;
default = config.services.postgresql.settings.port;
defaultText = lib.literalExpression "config.services.postgresql.settings.port";
description = ''
The database port Piped should use.

Defaults to the the default postgresql port.
'';
};

database = lib.mkOption {
type = lib.types.str;
default = "piped";
description = ''
The database Piped should use.
'';
};
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be a single url option, which is what piped-backend's config uses anyhow.

Comment on lines +127 to +132
domain = lib.mkOption {
type = lib.types.str;
description = ''
The domain Piped Backend is reachable on.
'';
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't that redundant with backend.externalUrl ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment