1
0
mirror of https://github.com/kmein/niveum synced 2026-03-18 19:11:08 +01:00

feat(flix): update

This commit is contained in:
2023-03-06 11:44:16 +01:00
parent 9d61f006a6
commit 18ec46c773

View File

@@ -4,14 +4,16 @@
... ...
}: let }: let
flixLocation = "/media/flix"; flixLocation = "/media/flix";
flixLocationNew = "/media/flix-new";
cacheLocation = "/var/cache/flix"; cacheLocation = "/var/cache/flix";
indexFilename = "index"; indexFilename = "index";
indexFilenameNew = "index-new";
flixUser = "flix"; flixUser = "flix";
flixGroup = "users"; flixGroup = "users";
inherit (import ../lib) tmpfilesConfig; inherit (import ../lib) tmpfilesConfig;
in { in {
fileSystems.${flixLocation} = { fileSystems.${flixLocation} = {
device = "prism.r:/export"; device = "prism.r:/export/download";
fsType = "nfs"; fsType = "nfs";
options = [ options = [
"noauto" "noauto"
@@ -26,6 +28,20 @@ in {
]; ];
}; };
fileSystems.${flixLocationNew} = {
device = "//yellow.r/public";
fsType = "cifs";
options = [
"guest"
"nofail"
"noauto"
"ro"
"x-systemd.automount"
"x-systemd.device-timeout=1"
"x-systemd.idle-timeout=1min"
];
};
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
(tmpfilesConfig { (tmpfilesConfig {
type = "d"; type = "d";
@@ -39,7 +55,10 @@ in {
systemd.services.flix-index = { systemd.services.flix-index = {
description = "Flix indexing service"; description = "Flix indexing service";
wants = ["network-online.target"]; wants = ["network-online.target"];
script = "cp ${flixLocation}/download/index ./${indexFilename}"; script = ''
cp ${flixLocation}/index ./${indexFilename}
cp ${flixLocationNew}/index ./${indexFilenameNew}
'';
startAt = "hourly"; startAt = "hourly";
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
@@ -69,11 +88,10 @@ in {
'') '')
(pkgs.writers.writeDashBin "flixmenu" '' (pkgs.writers.writeDashBin "flixmenu" ''
set -efu set -efu
cd "${flixLocation}/download" cd "${flixLocation}"
[ -f "${cacheLocation}/${indexFilename}" ] || exit 1 cat ${cacheLocation}/${indexFilename} ${cacheLocation}/${indexFilenameNew} \
| ${pkgs.dmenu}/bin/dmenu -i -p flix -l 5 "$@" \
${pkgs.dmenu}/bin/dmenu -i -p flix -l 5 "$@" < ${cacheLocation}/${indexFilename} \
| ${pkgs.findutils}/bin/xargs -I '{}' ${pkgs.util-linux}/bin/setsid ${pkgs.xdg-utils}/bin/xdg-open '{}' | ${pkgs.findutils}/bin/xargs -I '{}' ${pkgs.util-linux}/bin/setsid ${pkgs.xdg-utils}/bin/xdg-open '{}'
'') '')
]; ];