added more options to piped and allow running individual components seporately
This commit is contained in:
parent
23e7886423
commit
f1722f84a4
|
@ -47,7 +47,7 @@ let
|
||||||
(mapAttrsToList (n: v: "${n}:${cfgToString v}") backend_config));
|
(mapAttrsToList (n: v: "${n}:${cfgToString v}") backend_config));
|
||||||
|
|
||||||
in {
|
in {
|
||||||
config = (lib.mkIf cfg.enable) {
|
config = lib.mkIf (cfg.enable && !cfg.disableBackend) {
|
||||||
systemd.tmpfiles.rules = [ "d /run/piped-backend - root root" ];
|
systemd.tmpfiles.rules = [ "d /run/piped-backend - root root" ];
|
||||||
|
|
||||||
systemd.services.piped-backend = {
|
systemd.services.piped-backend = {
|
||||||
|
|
|
@ -6,10 +6,32 @@ in {
|
||||||
enable = mkEnableOption "piped";
|
enable = mkEnableOption "piped";
|
||||||
|
|
||||||
frontendDomain = mkOption { type = types.str; };
|
frontendDomain = mkOption { type = types.str; };
|
||||||
backendDomain = mkOption { type = types.str; };
|
backendDomain = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = "Set to null to use project default backend";
|
||||||
|
};
|
||||||
proxyDomain = mkOption { type = types.str; };
|
proxyDomain = mkOption { type = types.str; };
|
||||||
#rydProxyDomain = mkOption { type = types.str; };
|
#rydProxyDomain = mkOption { type = types.str; };
|
||||||
|
|
||||||
|
disableFrontend = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Don't host frontend";
|
||||||
|
};
|
||||||
|
|
||||||
|
disableBackend = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Don't host backend";
|
||||||
|
};
|
||||||
|
|
||||||
|
disableProxy = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Don't host proxy";
|
||||||
|
};
|
||||||
|
|
||||||
feedRetentionDays = mkOption {
|
feedRetentionDays = mkOption {
|
||||||
type = types.number;
|
type = types.number;
|
||||||
default = 30;
|
default = 30;
|
||||||
|
|
|
@ -4,9 +4,8 @@ let
|
||||||
cfg = config.services.piped;
|
cfg = config.services.piped;
|
||||||
frontend-package =
|
frontend-package =
|
||||||
(pkgs.piped-frontend.override { backendDomain = cfg.backendDomain; });
|
(pkgs.piped-frontend.override { backendDomain = cfg.backendDomain; });
|
||||||
|
|
||||||
in {
|
in {
|
||||||
config = (lib.mkIf cfg.enable) {
|
config = lib.mkIf (cfg.enable && !cfg.disableFrontend) {
|
||||||
services.nginx.virtualHosts."${cfg.frontendDomain}" = {
|
services.nginx.virtualHosts."${cfg.frontendDomain}" = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
|
|
|
@ -23,6 +23,7 @@ let
|
||||||
access_log off;
|
access_log off;
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
|
config = lib.mkIf (cfg.enable && !cfg.disableProxy) {
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d /run/piped-proxy - nginx nginx"
|
"d /run/piped-proxy - nginx nginx"
|
||||||
"d /run/piped-proxy/socket - nginx nginx"
|
"d /run/piped-proxy/socket - nginx nginx"
|
||||||
|
@ -54,4 +55,5 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{ stdenv, nodejs, nodePackages, mkYarnPackage, rsync, fetchFromGitHub
|
{ stdenv, nodejs, nodePackages, mkYarnPackage, rsync, fetchFromGitHub,
|
||||||
, backendDomain ? "CHANGE_ME", }:
|
# Backend domain override, if unset then use project default
|
||||||
|
backendDomain ? null, }:
|
||||||
let
|
let
|
||||||
meta = builtins.fromJSON (builtins.readFile ../meta.json);
|
meta = builtins.fromJSON (builtins.readFile ../meta.json);
|
||||||
rev = meta.frontend.rev;
|
rev = meta.frontend.rev;
|
||||||
|
@ -18,8 +19,11 @@ in mkYarnPackage rec {
|
||||||
yarnNix = ./yarn.nix;
|
yarnNix = ./yarn.nix;
|
||||||
|
|
||||||
patchPhase = ''
|
patchPhase = ''
|
||||||
|
${if backendDomain != null then ''
|
||||||
sed -i "s#pipedapi.kavin.rocks#${backendDomain}#g" src/main.js
|
sed -i "s#pipedapi.kavin.rocks#${backendDomain}#g" src/main.js
|
||||||
sed -i "s#pipedapi.kavin.rocks#${backendDomain}#g" src/components/PreferencesPage.vue
|
sed -i "s#pipedapi.kavin.rocks#${backendDomain}#g" src/components/PreferencesPage.vue
|
||||||
|
'' else
|
||||||
|
""}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
|
|
Loading…
Reference in a new issue