peertube: split peertube-cli utility

This commit is contained in:
Izorkin 2023-12-12 17:43:48 +03:00
parent 00e4bf4d02
commit 6e61227199
No known key found for this signature in database
GPG Key ID: 1436C1B3F3679F09
2 changed files with 10 additions and 8 deletions

View File

@ -61,10 +61,6 @@ let
eval -- "\$@"
'';
peertubeCli = pkgs.writeShellScriptBin "peertube-cli" ''
node ~/apps/peertube-cli/dist/peertube.js $@
'';
nginxCommonHeaders = lib.optionalString cfg.enableWebHttps ''
add_header Strict-Transport-Security 'max-age=63072000; includeSubDomains';
'' + lib.optionalString config.services.nginx.virtualHosts.${cfg.localDomain}.http3 ''
@ -330,6 +326,8 @@ in {
}
];
environment.systemPackages = [ cfg.package.cli ];
services.peertube.settings = lib.mkMerge [
{
listen = {
@ -849,7 +847,7 @@ in {
home = cfg.package;
};
})
(lib.attrsets.setAttrByPath [ cfg.user "packages" ] [ peertubeEnv peertubeCli pkgs.nodejs_18 pkgs.yarn pkgs.ffmpeg-headless ])
(lib.attrsets.setAttrByPath [ cfg.user "packages" ] [ peertubeEnv pkgs.nodejs_18 pkgs.yarn pkgs.ffmpeg-headless ])
(lib.mkIf cfg.redis.enableUnixSocket {${config.services.peertube.user}.extraGroups = [ "redis-peertube" ];})
];

View File

@ -69,6 +69,8 @@ stdenv.mkDerivation rec {
hash = "sha256-xsB71bnaPn/9/f1KHyU3TTwx+Q+1dLjWmNK2aVJgoRY=";
};
outputs = [ "out" "cli" ];
nativeBuildInputs = [ brotli prefetch-yarn-deps jq which yarn ];
buildInputs = [ nodejs ];
@ -107,7 +109,7 @@ stdenv.mkDerivation rec {
# Build PeerTube client
npm run build:client
# Build PeerTube tools
# Build PeerTube cli
npm run build:peertube-cli
patchShebangs ~/apps/peertube-cli/dist/peertube.js
@ -128,8 +130,6 @@ stdenv.mkDerivation rec {
mv ~/node_modules $out/node_modules
mkdir $out/client
mv ~/client/{dist,node_modules,package.json,yarn.lock} $out/client
mkdir -p $out/apps/peertube-cli
mv ~/apps/peertube-cli/{dist,node_modules,package.json,yarn.lock} $out/apps/peertube-cli
mkdir -p $out/packages/{core-utils,ffmpeg,models,node-utils,server-commands,typescript-utils}
mv ~/packages/core-utils/{dist,package.json} $out/packages/core-utils
mv ~/packages/ffmpeg/{dist,package.json} $out/packages/ffmpeg
@ -139,6 +139,10 @@ stdenv.mkDerivation rec {
mv ~/packages/typescript-utils/{dist,package.json} $out/packages/typescript-utils
mv ~/{config,support,CREDITS.md,FAQ.md,LICENSE,README.md,package.json,yarn.lock} $out
mkdir -p $cli/bin
mv ~/apps/peertube-cli/{dist,node_modules,package.json,yarn.lock} $cli
ln -s $cli/dist/peertube.js $cli/bin/peertube-cli
# Create static gzip and brotli files
find $out/client/dist -type f -regextype posix-extended -iregex '.*\.(css|eot|html|js|json|svg|webmanifest|xlf)' | while read file; do
gzip -9 -n -c $file > $file.gz