configuration/packages/organize-downloads.nix
2024-01-03 07:43:25 -08:00

25 lines
693 B
Nix

{ pkgs, ... }:
let
inherit (builtins) readFile;
handler = with pkgs; resholve.writeScriptBin "organize-downloads" {
interpreter = "${bash}/bin/bash";
inputs = [ coreutils efficient-compression-tool ];
} (readFile ./resources/organize-downloads);
in
{
config = {
systemd.user.paths.organize-downloads = {
Unit.Description = "Watch downloads";
Path.PathExistsGlob = "%h/Downloads/Screen{s,\\ S}hot\\ *.png";
Install.WantedBy = [ "default.target" ];
};
systemd.user.services.organize-downloads = {
Unit.Description = "Organize downloads";
Service.ExecStart = "${handler}/bin/organize-downloads";
Service.Nice = 10;
};
};
}