update everything and use different mangal version

This commit is contained in:
Kopatz
2025-02-03 23:22:46 +01:00
parent 8bb9019085
commit d341e7c0fc
8 changed files with 225 additions and 188 deletions

View File

@@ -9,5 +9,5 @@
kop-website =
pkgs.callPackage ./website/default.nix { inherit kop-hub ente-frontend; };
sddm-astronaut = pkgs.callPackage ./sddm-astronaut/default.nix { };
mangal-patched = pkgs.callPackage ./mangal/default.nix { mangal = pkgs.mangal; };
mangal-patched = pkgs.callPackage ./mangal/default.nix { };
}

View File

@@ -1,6 +1,46 @@
{ mangal }:
let
addPatches = pkg: patches:
pkg.overrideAttrs
(oldAttrs: { patches = (oldAttrs.patches or [ ]) ++ patches; });
in addPatches mangal [ ./mangal.diff ]
{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
installShellFiles,
}:
buildGoModule rec {
name = "mangal";
pname = "mangal";
src = fetchFromGitHub {
owner = "Kropatz";
repo = pname;
rev = "ed061400fbadb0ecceb4f9ae0a39da42475b709d";
hash = "sha256-778jdPJC8wzrwawbuTPbS5vCOAR76G+1WvbMpQ7jpNw=";
};
vendorHash = "sha256-FOi36EmbggxkJ1/wtBO9Vrr716z3dwDevSokFKWwGzY=";
ldflags = [
"-s"
"-w"
];
nativeBuildInputs = [ installShellFiles ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
# Mangal creates a config file in the folder ~/.config/mangal and fails if not possible
export HOME=$(mktemp -d)
installShellCompletion --cmd mangal \
--bash <($out/bin/mangal completion bash) \
--zsh <($out/bin/mangal completion zsh) \
--fish <($out/bin/mangal completion fish)
'';
doCheck = false; # test fail because of sandbox
meta = with lib; {
description = "CLI app written in Go which scrapes, downloads and packs manga into different formats";
homepage = "https://github.com/metafates/mangal";
license = licenses.mit;
maintainers = [ maintainers.bertof ];
mainProgram = "mangal";
};
}

View File

@@ -1,28 +0,0 @@
diff --git a/provider/manganato/manganato.go b/provider/manganato/manganato.go
index e7d0c62..7af6542 100644
--- a/provider/manganato/manganato.go
+++ b/provider/manganato/manganato.go
@@ -20,7 +20,7 @@ var Config = &generic.Configuration{
query = strings.TrimSpace(query)
query = strings.ToLower(query)
query = url.QueryEscape(query)
- template := "https://chapmanganato.com/https://manganato.com/search/story/%s"
+ template := "https://manganato.com/search/story/%s"
return fmt.Sprintf(template, query)
},
MangaExtractor: &generic.Extractor{
diff --git a/inline/inline.go b/inline/inline.go
index 26ad0c6..dc02fda 100644
--- a/inline/inline.go
+++ b/inline/inline.go
@@ -131,6 +132,10 @@ func Run(options *Options) (err error) {
if err != nil {
log.Warn(err)
}
+ // free memory after downloading
+ for _, page := range chapter.Pages {
+ page.Contents = nil
+ }
} else {
err := downloader.Read(chapter, func(string) {})
if err != nil {