mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
fix(flix): use global cache location
This commit is contained in:
@@ -1,40 +1,42 @@
|
||||
{ config, pkgs, ... }:
|
||||
let flixLocation = "/media/flix";
|
||||
let
|
||||
flixLocation = "/media/flix";
|
||||
cacheLocation = "/var/cache/flix";
|
||||
in {
|
||||
imports = [ <stockholm/krebs/3modules/permown.nix> ];
|
||||
|
||||
fileSystems.${flixLocation} = {
|
||||
device = "prism.r:/export";
|
||||
fsType = "nfs";
|
||||
};
|
||||
|
||||
systemd.user.services.flix-index = {
|
||||
description = "Flix indexing service";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "default.target" ];
|
||||
script = ''
|
||||
cachedir="${config.users.users.me.home}/.cache"
|
||||
flix_cache="$cachedir/flix_index"
|
||||
krebs.permown.${cacheLocation} = {
|
||||
owner = config.users.users.me.name;
|
||||
group = "users";
|
||||
umask = "0000";
|
||||
};
|
||||
|
||||
[ -d "$cachedir" ] || mkdir -p "$cachedir"
|
||||
systemd.services.flix-index = {
|
||||
description = "Flix indexing service";
|
||||
wants = [ "network-online.target" ];
|
||||
script = ''
|
||||
flix_cache="${cacheLocation}/flix_index"
|
||||
|
||||
find ${flixLocation} -type f > "$flix_cache"
|
||||
'';
|
||||
startAt = "hourly";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = config.users.users.me.name;
|
||||
};
|
||||
serviceConfig.Type = "oneshot";
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeDashBin "flixmenu" ''
|
||||
set -efu
|
||||
cachedir="${config.users.users.me.home}/.cache"
|
||||
flix_cache="$cachedir/flix_index"
|
||||
flix_cache="${cacheLocation}/flix_index"
|
||||
|
||||
[ -f "$flix_cache" ] || exit 1
|
||||
|
||||
${pkgs.dmenu}/bin/dmenu -i -p flix -l 5 "$@" < "$flix_cache" \
|
||||
| ${pkgs.findutils}/bin/xargs -I '{}' ${pkgs.xdg_utils}/bin/xdg-open '{}'
|
||||
| ${pkgs.findutils}/bin/xargs -I '{}' ${pkgs.utillinux}/bin/setsid ${pkgs.xdg_utils}/bin/xdg-open '{}'
|
||||
'')
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user