{shoko-webui,shoko,nixos/shoko}: init (#350065)
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
|
||||
- [Komodo Periphery](https://github.com/moghtech/komodo), a multi-server Docker and Git deployment agent by Komodo. Available as [services.komodo-periphery](#opt-services.komodo-periphery.enable).
|
||||
|
||||
- [Shoko](https://shokoanime.com), an anime management system. Available as [services.shoko](#opt-services.shoko.enable).
|
||||
|
||||
## Backward Incompatibilities {#sec-release-26.05-incompatibilities}
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
||||
@@ -942,6 +942,7 @@
|
||||
./services/misc/servarr/sonarr.nix
|
||||
./services/misc/servarr/whisparr.nix
|
||||
./services/misc/serviio.nix
|
||||
./services/misc/shoko.nix
|
||||
./services/misc/sickbeard.nix
|
||||
./services/misc/snapper.nix
|
||||
./services/misc/soft-serve.nix
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
mkIf
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
getExe
|
||||
optionalString
|
||||
;
|
||||
|
||||
cfg = config.services.shoko;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.shoko = {
|
||||
enable = mkEnableOption "Shoko";
|
||||
|
||||
package = mkPackageOption pkgs "shoko" { };
|
||||
webui = mkPackageOption pkgs "shoko-webui" { nullable = true; };
|
||||
plugins = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [ ];
|
||||
description = ''
|
||||
The plugins to install.
|
||||
|
||||
Note that if there are plugins installed imperatively when this
|
||||
option is used, they will be deleted.
|
||||
'';
|
||||
};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Open ports in the firewall for the ShokoAnime api and web interface.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ 8111 ];
|
||||
|
||||
systemd.services.shoko = {
|
||||
description = "Shoko Server";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
# Not that it should be done, but this makes it easier to override the
|
||||
# StateDirectory option, if the user really wants to.
|
||||
environment.SHOKO_HOME = "/var/lib/${config.systemd.services.shoko.serviceConfig.StateDirectory}";
|
||||
|
||||
# The rm calls are here, because it's pretty easy to get into a situation
|
||||
# where those directories are created imperatively, in which case the ln
|
||||
# calls (along with the service) would just fail.
|
||||
preStart =
|
||||
optionalString (cfg.webui != null) ''
|
||||
rm -rf "$STATE_DIRECTORY/webui"
|
||||
ln -s '${cfg.webui}' "$STATE_DIRECTORY/webui"
|
||||
''
|
||||
+ optionalString (cfg.plugins != [ ]) ''
|
||||
rm -rf "$STATE_DIRECTORY/plugins"
|
||||
ln -s '${pkgs.linkFarmFromDrvs cfg.plugins}' "$STATE_DIRECTORY/plugins"
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
|
||||
DynamicUser = true;
|
||||
StateDirectory = "shoko";
|
||||
StateDirectoryMode = 750;
|
||||
|
||||
ExecStart = getExe cfg.package;
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta.maintainers = with lib.maintainers; [
|
||||
diniamo
|
||||
nanoyaki
|
||||
];
|
||||
}
|
||||
@@ -1400,6 +1400,7 @@ in
|
||||
sharkey = runTest ./web-apps/sharkey.nix;
|
||||
shattered-pixel-dungeon = runTest ./shattered-pixel-dungeon.nix;
|
||||
shiori = runTest ./shiori.nix;
|
||||
shoko = runTest ./shoko.nix;
|
||||
signal-desktop = runTest ./signal-desktop.nix;
|
||||
silverbullet = runTest ./silverbullet.nix;
|
||||
simple = runTest ./simple.nix;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
name = "Shoko";
|
||||
|
||||
nodes.machine = {
|
||||
services.shoko.enable = true;
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("shoko.service")
|
||||
machine.wait_for_open_port(8111)
|
||||
machine.succeed("curl --fail http://localhost:8111")
|
||||
'';
|
||||
|
||||
meta.maintainers = with lib.maintainers; [
|
||||
diniamo
|
||||
nanoyaki
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
diff --git a/vite.config.mjs b/vite.config.mjs
|
||||
index 481b319..186ba94 100644
|
||||
--- a/vite.config.mjs
|
||||
+++ b/vite.config.mjs
|
||||
@@ -1,6 +1,5 @@
|
||||
import path from 'path';
|
||||
import { writeFile } from 'fs/promises';
|
||||
-import childProcess from 'child_process';
|
||||
import pkg from './package.json';
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
@@ -54,7 +53,7 @@ export default defineConfig(async () => {
|
||||
});
|
||||
|
||||
async function setupEnv(isDebug) {
|
||||
- const gitHash = childProcess.execSync("git log --pretty=format:'%h' -n 1").toString().replace(/["']/g, '');
|
||||
+ const gitHash = '';
|
||||
const appVersion = pkg.version;
|
||||
|
||||
process.env.VITE_GITHASH = gitHash;
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
stdenvNoCC,
|
||||
fetchFromGitHub,
|
||||
fetchPnpmDeps,
|
||||
nodejs,
|
||||
pnpm,
|
||||
pnpmConfigHook,
|
||||
lib,
|
||||
shoko,
|
||||
nix-update-script,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
pname = "shoko-webui";
|
||||
version = "2.2.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ShokoAnime";
|
||||
repo = "Shoko-WebUI";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-plXTAN3V0tcAe+uMs4XwYHO1UC9DCAxcMPVNKdFobcY=";
|
||||
};
|
||||
|
||||
# Avoid requiring git as a build time dependency. It's used for version
|
||||
# checking in the updater, which shouldn't be used if the webui is managed
|
||||
# declaratively anyway.
|
||||
patches = [ ./no-commit-hash.patch ];
|
||||
|
||||
pnpmDeps = fetchPnpmDeps {
|
||||
inherit (finalAttrs) pname version src;
|
||||
fetcherVersion = 3;
|
||||
hash = "sha256-4/Qbg+jUagPUiQPoc57drorbEkn1ShsPZynvct+HX7A=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
nodejs
|
||||
pnpm
|
||||
pnpmConfigHook
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
pnpm build
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
cp -r dist $out
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.updateSript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/ShokoAnime/Shoko-WebUI";
|
||||
changelog = "https://github.com/ShokoAnime/Shoko-WebUI/releases/tag/v${finalAttrs.version}";
|
||||
description = "Web-based frontend for the Shoko anime management system";
|
||||
maintainers = with lib.maintainers; [
|
||||
diniamo
|
||||
nanoyaki
|
||||
];
|
||||
inherit (shoko.meta) license platforms;
|
||||
};
|
||||
})
|
||||
Generated
+2137
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,57 @@
|
||||
{
|
||||
buildDotnetModule,
|
||||
fetchFromGitHub,
|
||||
dotnet-sdk_8,
|
||||
dotnet-aspnetcore_8,
|
||||
nixosTests,
|
||||
lib,
|
||||
mediainfo,
|
||||
rhash,
|
||||
nix-update-script,
|
||||
}:
|
||||
buildDotnetModule (finalAttrs: {
|
||||
pname = "shoko";
|
||||
version = "5.1.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ShokoAnime";
|
||||
repo = "ShokoServer";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-ZO5S0zMwzr4giaO1bmQ4dLBIPrv6eZY7k9Os4GiO4C4=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
dotnet-sdk = dotnet-sdk_8;
|
||||
dotnet-runtime = dotnet-aspnetcore_8;
|
||||
|
||||
nugetDeps = ./deps.json;
|
||||
projectFile = "Shoko.CLI/Shoko.CLI.csproj";
|
||||
dotnetBuildFlags = "/p:InformationalVersion=\"channel=stable\"";
|
||||
|
||||
executables = [ "Shoko.CLI" ];
|
||||
makeWrapperArgs = [
|
||||
"--prefix"
|
||||
"PATH"
|
||||
":"
|
||||
"${mediainfo}/bin"
|
||||
];
|
||||
runtimeDeps = [ rhash ];
|
||||
|
||||
passthru = {
|
||||
updateScript = nix-update-script { };
|
||||
tests.shoko = nixosTests.shoko;
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/ShokoAnime/ShokoServer";
|
||||
changelog = "https://github.com/ShokoAnime/ShokoServer/releases/tag/v${finalAttrs.version}";
|
||||
description = "Backend for the Shoko anime management system";
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "Shoko.CLI";
|
||||
maintainers = with lib.maintainers; [
|
||||
diniamo
|
||||
nanoyaki
|
||||
];
|
||||
inherit (dotnet-sdk_8.meta) platforms;
|
||||
};
|
||||
})
|
||||
Reference in New Issue
Block a user