allow changing package for piped components, allow turning off webp/avif encoding on proxy
This commit is contained in:
parent
6ef001f2a8
commit
a2c58be308
|
@ -20,7 +20,7 @@
|
|||
nixosModules.piped = import ./module/default.nix;
|
||||
nixosModules.default = self.nixosModules.piped;
|
||||
|
||||
overlays.piped = final: prev: {
|
||||
overlays.piped = final: _prev: {
|
||||
piped-frontend = final.callPackage ./packages/frontend {};
|
||||
piped-backend = final.callPackage ./packages/backend {
|
||||
jre = final.openjdk19_headless;
|
||||
|
@ -36,6 +36,8 @@
|
|||
overlays = [self.overlays.default];
|
||||
};
|
||||
in {
|
||||
formatter = pkgs.alejandra;
|
||||
|
||||
packages = {
|
||||
inherit (pkgs) piped-frontend;
|
||||
inherit (pkgs) piped-backend;
|
||||
|
|
|
@ -101,7 +101,7 @@ in {
|
|||
''}
|
||||
'';
|
||||
|
||||
ExecStart = "${pkgs.piped-backend}/bin/piped-backend";
|
||||
ExecStart = "${cfg.backendPackage}/bin/piped-backend";
|
||||
|
||||
RestartSec = "5s";
|
||||
User = "piped";
|
||||
|
|
|
@ -1,27 +1,31 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) types;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
|
||||
|
||||
cfg = config.services.piped;
|
||||
in {
|
||||
options.services.piped = {
|
||||
enable = mkEnableOption "piped";
|
||||
|
||||
frontendPackage = mkPackageOption pkgs "piped-frontend" {};
|
||||
frontendDomain = mkOption {
|
||||
type = types.str;
|
||||
description = "Domain where the frontend will be displayed";
|
||||
};
|
||||
|
||||
backendPackage = mkPackageOption pkgs "piped-backend" {};
|
||||
backendDomain = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "Domain where the backend will be hosted. Set to null for project's default backend";
|
||||
};
|
||||
|
||||
proxyPackage = mkPackageOption pkgs "piped-proxy" {};
|
||||
proxyDomain = mkOption {
|
||||
type = types.str;
|
||||
description = "Domain used for the proxy server";
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
@ -9,7 +8,7 @@
|
|||
cfg = config.services.piped;
|
||||
|
||||
frontendPackage =
|
||||
pkgs.piped-frontend.override {backendDomain = cfg.backendDomain;};
|
||||
cfg.frontendPackage.override {backendDomain = cfg.backendDomain;};
|
||||
in {
|
||||
config = mkIf (cfg.enable && !cfg.disableFrontend && !cfg.disableNginx) {
|
||||
# https://github.com/TeamPiped/Piped/blob/master/docker/nginx.conf
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
@ -14,7 +13,7 @@ in {
|
|||
environment.BIND = "0.0.0.0:${toString cfg.internalProxyPort}";
|
||||
environment.IPV4_ONLY = mkIf cfg.proxyIPv4Only "1";
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.piped-proxy}/bin/piped-proxy";
|
||||
ExecStart = "${cfg.proxyPackage}/bin/piped-proxy";
|
||||
|
||||
RestartSec = "5s";
|
||||
User = "piped";
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
{ fetchurl, fetchgit, linkFarm, runCommand, gnutar }: rec {
|
||||
{
|
||||
fetchurl,
|
||||
fetchgit,
|
||||
linkFarm,
|
||||
runCommand,
|
||||
gnutar,
|
||||
}: rec {
|
||||
offline_cache = linkFarm "offline" packages;
|
||||
packages = [
|
||||
{
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
{
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
nasm
|
||||
nasm,
|
||||
withWebP ? true,
|
||||
withAVIF ? true,
|
||||
}: let
|
||||
meta = builtins.fromJSON (builtins.readFile ../../meta.json);
|
||||
rev = meta.proxy.rev;
|
||||
|
@ -17,9 +19,23 @@ in
|
|||
};
|
||||
|
||||
buildNoDefaultFeatures = true;
|
||||
buildFeatures = [ "webp" "avif" ];
|
||||
buildFeatures =
|
||||
[]
|
||||
++ (
|
||||
if withAVIF
|
||||
then ["avif"]
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if withWebP
|
||||
then ["webp"]
|
||||
else []
|
||||
);
|
||||
|
||||
nativeBuildInputs = [ nasm ];
|
||||
nativeBuildInputs =
|
||||
if withAVIF
|
||||
then [nasm]
|
||||
else [];
|
||||
|
||||
cargoLock = {lockFile = "${src}/Cargo.lock";};
|
||||
doCheck = false;
|
||||
|
|
Loading…
Reference in a new issue