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