update kavita

This commit is contained in:
Kopatz
2024-09-09 12:06:44 +02:00
parent da40ad35d9
commit 9512c491e9
5 changed files with 71 additions and 52 deletions

View File

@@ -18,8 +18,8 @@
collectGarbage = "nh clean all"; collectGarbage = "nh clean all";
edit = "cd ~/projects/github/nix-config && nvim ."; edit = "cd ~/projects/github/nix-config && nvim .";
ll = "ls -l"; ll = "ls -l";
ls = "eza --icons always"; ls = "${pkgs.eza}/bin/eza --icons always";
la = "eza -la --icons --group-directories-first"; la = "${pkgs.eza}/bin/eza -la --icons --group-directories-first";
ssh = "TERM=xterm-256color ssh"; ssh = "TERM=xterm-256color ssh";
update = "sudo nixos-rebuild switch"; update = "sudo nixos-rebuild switch";
updateFancy = "nh os switch"; updateFancy = "nh os switch";

View File

@@ -9,7 +9,7 @@ in {
default = true; default = true;
description = "Should it use https?"; description = "Should it use https?";
}; };
autoDownload = { autoDownload = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = "Should it auto download?"; description = "Should it auto download?";
@@ -19,6 +19,7 @@ in {
type = types.path; type = types.path;
description = "data path"; description = "data path";
}; };
isTest = mkEnableOption "Is this a test vm?";
}; };
config = let config = let
fqdn = "kavita-kopatz.duckdns.org"; fqdn = "kavita-kopatz.duckdns.org";
@@ -38,7 +39,7 @@ in {
] ++ lib.optional githubRunnerEnabled ] ++ lib.optional githubRunnerEnabled
"d ${baseDir}/github 0770 github-actions-runner kavita -"; "d ${baseDir}/github 0770 github-actions-runner kavita -";
age.secrets.kavita = { age.secrets.kavita = mkIf (!cfg.isTest) {
file = ../../secrets/kavita.age; file = ../../secrets/kavita.age;
owner = "kavita"; owner = "kavita";
group = "kavita"; group = "kavita";
@@ -48,23 +49,29 @@ in {
enable = true; enable = true;
user = "kavita"; user = "kavita";
package = let package = let
backend = pkgs.kavita.backend.overrideAttrs backend = pkgs.unstable.kavita.backend.overrideAttrs
(old: { patches = old.patches ++ [ ./kavita-patches.diff ]; }); (old: { patches = old.patches ++ [ ./kavita-patches.diff ]; });
kavitaPatched = pkgs.kavita.overrideAttrs (old: { backend = backend; }); kavitaPatched = pkgs.unstable.kavita.overrideAttrs (old: { backend = backend; });
in kavitaPatched; in kavitaPatched;
settings.Port = 5000; settings = {
Port = 5000;
IpAddresses = "127.0.0.1";
BaseUrl = "/kavita";
};
dataDir = baseDir; dataDir = baseDir;
tokenKeyFile = config.age.secrets.kavita.path; tokenKeyFile = if cfg.isTest then
settings.IpAddresses = "127.0.0.1"; (builtins.toFile "test"
settings.BaseUrl = "/kavita"; "wWKNeGUslGILrUUp8Dnn4xyYnivZWBb8uqjKg3ALyCs7reV5v3CtE/E2b6i0Mwz1Xw1p9a0wcduRDNoa8Yh8kQ==")
else
config.age.secrets.kavita.path;
}; };
#todo: base url needs new kavita version #todo: base url needs new kavita version
systemd.services.kavita = { systemd.services = {
kavita = {
after = [ "nginx.service" ] ++ lib.optional useStepCa "step-ca.service"; after = [ "nginx.service" ] ++ lib.optional useStepCa "step-ca.service";
}; };
download-manga = mkIf cfg.autoDownload {
systemd.services.download-manga = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
@@ -91,6 +98,7 @@ in {
WorkingDirectory = "${baseDir}/manga"; WorkingDirectory = "${baseDir}/manga";
}; };
}; };
};
# services.nginx.virtualHosts."kopatz.ddns.net".locations."/kavita" = { # services.nginx.virtualHosts."kopatz.ddns.net".locations."/kavita" = {
# proxyPass = "http://127.0.0.1:5000"; # proxyPass = "http://127.0.0.1:5000";

View File

@@ -1,7 +1,7 @@
{ pkgs, config, lib, modulesPath, ... }: { { pkgs, config, lib, modulesPath, ... }: {
imports = [ imports = [
#./vm-common.nix ./vm-common.nix
(modulesPath + "/profiles/qemu-guest.nix") (modulesPath + "/profiles/qemu-guest.nix")
#(modulesPath + "/profiles/minimal.nix") #(modulesPath + "/profiles/minimal.nix")
]; ];
@@ -25,7 +25,26 @@
#sddm.enable = true; #sddm.enable = true;
#cosmic.enable = true; #cosmic.enable = true;
}; };
services = {
kavita = {
enable = true;
https = false;
autoDownload = false;
isTest = true;
}; };
};
};
services.xserver = {
enable = true;
desktopManager = {
xterm.enable = false;
xfce.enable = true;
};
displayManager.defaultSession = "xfce";
};
programs.firefox.enable = true;
virtualisation.vmVariant = { virtualisation.vmVariant = {
#virtualisation.qemu.options = [ #virtualisation.qemu.options = [
# "-device virtio-vga-gl" # "-device virtio-vga-gl"

View File

@@ -1,20 +1,12 @@
{ inputs { inputs, pkgs, lib, config, ... }: {
, pkgs
, lib
, config
, ...
}:
{
imports = [ ../default.nix ]; imports = [ ../default.nix ];
mainUser.name = "vm"; mainUser.name = "vm";
home-manager = { home-manager = { users.${config.mainUser.name} = import ./home.nix; };
users.${config.mainUser.name} = import ./home.nix;
};
programs.zsh.enable = true; programs.zsh.enable = true;
users.users.${config.mainUser.name} = { users.users.${config.mainUser.name} = {
isNormalUser = true ; isNormalUser = true;
initialPassword = "test"; initialPassword = "test";
description = config.mainUser.name; description = config.mainUser.name;
shell = pkgs.zsh; shell = pkgs.zsh;

View File

@@ -3,7 +3,7 @@
imports = [ imports = [
#../../home-manager/nvim.nix #../../home-manager/nvim.nix
#../../home-manager/zsh ../../home-manager/zsh
#../../home-manager/rofi.nix #../../home-manager/rofi.nix
#../../home-manager/kitty.nix #../../home-manager/kitty.nix
#../../home-manager/i3.nix #../../home-manager/i3.nix