Add fzgo timer

This commit is contained in:
Thomas Avé 2025-01-28 13:58:20 +01:00
parent 4cdd4d3cf6
commit 2a3f2210b5
2 changed files with 18 additions and 10 deletions

View File

@ -1,11 +1,19 @@
{ inputs, config, pkgs, ... }:
let
username = "server";
home_dir = "/home/${username}";
scripts = {
disk_check = import ./utils/disk_check.nix { inherit pkgs; };
# vdirsyncer = {
# when = "*:0/15";
# script = toString (pkgs.writeShellScript "script" '' ${pkgs.vdirsyncer}/bin/vdirsyncer sync imec/pair '');
# };
fzgo = {
when = "*:0/5";
script = toString (pkgs.writeShellScript "script" ''
${pkgs.zsh}/bin/zsh -c "source ${./zsh/files/fzgo.zsh} && fzgo_update_cache"
'');
};
mbsync = {
when = "*-*-* 00:00:00";
script = toString (pkgs.writeShellScript "script" ''
@ -48,19 +56,19 @@ let
};
};
fzgo_paths = [
"/home/server/.dotfiles"
"/home/server/Containers"
"/home/server/Workspace"
"/home/server/Storage/Thomas"
"/home/server/Storage/Shared"
"${home_dir}/.dotfiles"
"${home_dir}/Workspace"
"${home_dir}/Containers"
"${home_dir}/Storage/Thomas"
"${home_dir}/Storage/Shared"
];
in {
home.username = "server";
home.homeDirectory = "/home/server";
home.username = username;
home.homeDirectory = home_dir;
nix = {
package = pkgs.nix;
settings = {
trusted-users = [ "server" ];
trusted-users = [ username ];
use-xdg-base-directories = true;
};
};
@ -73,7 +81,7 @@ in {
(import ./utils/fzgo_links.nix { inherit config pkgs fzgo_paths; })
./ssh
];
programs.ssh.matchBlocks."*".identityFile = "/home/server/.secrets/SSH/Mallorea/id_ed25519";
programs.ssh.matchBlocks."*".identityFile = "${home_dir}/.secrets/SSH/Mallorea/id_ed25519";
home.sessionVariables = {
NIX_PATH = "${config.xdg.stateHome}/nix/profiles/channels/";

View File

@ -47,7 +47,7 @@ function fzgo_update_cache() {
if [ -d "$entry" ]; then
out_file="$(echo "$entry" | sed 's\/\|\g')"
out_file="$XDG_CACHE_HOME/fzgo/entries/$file_type/$out_file"
mkdir -p "$(dirname \"$out_file\")"
mkdir -p "$(dirname $out_file)"
fd . "$entry" -t "$file_type" > "$out_file"
fi
done