applied nixfmt (new version)
This commit is contained in:
@@ -1,90 +1,113 @@
|
||||
{ pkgs, lib, config, ... }: {
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ ./base.nix ];
|
||||
options.my.units.download.enable = lib.mkEnableOption "enable";
|
||||
config = let
|
||||
download = with pkgs;
|
||||
python3Packages.buildPythonApplication {
|
||||
pname = "download";
|
||||
version = "2.5";
|
||||
src = ../../scripts/download/.;
|
||||
build-system = with python3Packages; [ setuptools ];
|
||||
dependencies = with python3Packages; [ pyyaml types-pyyaml yt-dlp ];
|
||||
propagatedBuildInputs = [ gallery-dl ffmpeg ];
|
||||
};
|
||||
in {
|
||||
home-manager.users.jawz = {
|
||||
xdg.configFile."gallery-dl/config.json".source =
|
||||
../../dotfiles/gallery-dl/config.json;
|
||||
services.lorri.enable = true;
|
||||
programs.bash = {
|
||||
shellAliases = {
|
||||
dl = "download -u jawz -i";
|
||||
comic = ''dl "$(cat "$LC" | fzf --multi --exact -i)"'';
|
||||
gallery = ''dl "$(cat "$LW" | fzf --multi --exact -i)"'';
|
||||
config =
|
||||
let
|
||||
download =
|
||||
with pkgs;
|
||||
python3Packages.buildPythonApplication {
|
||||
pname = "download";
|
||||
version = "2.5";
|
||||
src = ../../scripts/download/.;
|
||||
build-system = with python3Packages; [ setuptools ];
|
||||
dependencies = with python3Packages; [
|
||||
pyyaml
|
||||
types-pyyaml
|
||||
yt-dlp
|
||||
];
|
||||
propagatedBuildInputs = [
|
||||
gallery-dl
|
||||
ffmpeg
|
||||
];
|
||||
};
|
||||
initExtra = ''
|
||||
list_root=$XDG_CONFIG_HOME/jawz/lists/jawz
|
||||
export LW=$list_root/watch.txt
|
||||
export LI=$list_root/instant.txt
|
||||
export LC=$list_root/comic.txt
|
||||
'';
|
||||
};
|
||||
};
|
||||
systemd.user = lib.mkIf config.my.units.download.enable {
|
||||
services = let
|
||||
mkDownloadService = desc: execStartCmd: {
|
||||
restartIfChanged = true;
|
||||
description = "Downloads ${desc}";
|
||||
wantedBy = [ "default.target" ];
|
||||
path = [ pkgs.bash download ];
|
||||
serviceConfig = {
|
||||
TimeoutStartSec = 2000;
|
||||
TimeoutStopSec = 2000;
|
||||
Restart = "on-failure";
|
||||
RestartSec = 30;
|
||||
ExecStart = "${download}/bin/download ${execStartCmd}";
|
||||
in
|
||||
{
|
||||
home-manager.users.jawz = {
|
||||
xdg.configFile."gallery-dl/config.json".source = ../../dotfiles/gallery-dl/config.json;
|
||||
services.lorri.enable = true;
|
||||
programs.bash = {
|
||||
shellAliases = {
|
||||
dl = "download -u jawz -i";
|
||||
comic = ''dl "$(cat "$LC" | fzf --multi --exact -i)"'';
|
||||
gallery = ''dl "$(cat "$LW" | fzf --multi --exact -i)"'';
|
||||
};
|
||||
initExtra = ''
|
||||
list_root=$XDG_CONFIG_HOME/jawz/lists/jawz
|
||||
export LW=$list_root/watch.txt
|
||||
export LI=$list_root/instant.txt
|
||||
export LC=$list_root/comic.txt
|
||||
'';
|
||||
};
|
||||
in {
|
||||
tuhmayto = mkDownloadService "tuhmayto stuff" ''
|
||||
-u jawz -i https://x.com/tuhmayto/media \
|
||||
https://www.furaffinity.net/user/tuhmayto/'';
|
||||
"download@" = mkDownloadService "post from multiple sources" "%I";
|
||||
"instagram@" = mkDownloadService "post types from instagram"
|
||||
"instagram -u jawz -t %I";
|
||||
};
|
||||
timers = let
|
||||
downloadTimer = time: delay: {
|
||||
enable = true;
|
||||
description = "Downloads post types from different sites";
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = time;
|
||||
RandomizedDelaySec = delay;
|
||||
Persistent = true;
|
||||
systemd.user = lib.mkIf config.my.units.download.enable {
|
||||
services =
|
||||
let
|
||||
mkDownloadService = desc: execStartCmd: {
|
||||
restartIfChanged = true;
|
||||
description = "Downloads ${desc}";
|
||||
wantedBy = [ "default.target" ];
|
||||
path = [
|
||||
pkgs.bash
|
||||
download
|
||||
];
|
||||
serviceConfig = {
|
||||
TimeoutStartSec = 2000;
|
||||
TimeoutStopSec = 2000;
|
||||
Restart = "on-failure";
|
||||
RestartSec = 30;
|
||||
ExecStart = "${download}/bin/download ${execStartCmd}";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
tuhmayto = mkDownloadService "tuhmayto stuff" ''
|
||||
-u jawz -i https://x.com/tuhmayto/media \
|
||||
https://www.furaffinity.net/user/tuhmayto/'';
|
||||
"download@" = mkDownloadService "post from multiple sources" "%I";
|
||||
"instagram@" = mkDownloadService "post types from instagram" "instagram -u jawz -t %I";
|
||||
};
|
||||
};
|
||||
in {
|
||||
"instagram@stories" = downloadTimer "*-*-* 08:12:00" 120 // { };
|
||||
"download@main" = downloadTimer "*-*-* 06,18:02:00" 30 // { };
|
||||
"download@push" = downloadTimer "*:0/5" 30 // { };
|
||||
"download@manga" = downloadTimer "Fri *-*-* 03:08:00" 30 // { };
|
||||
# "download@kemono" = downloadTimer
|
||||
# "*-*-1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31 18:06:00" 60 // { };
|
||||
tuhmayto = {
|
||||
enable = true;
|
||||
description = "Downloads tuhmayto stuff";
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = { OnCalendar = "*:0/10"; };
|
||||
};
|
||||
timers =
|
||||
let
|
||||
downloadTimer = time: delay: {
|
||||
enable = true;
|
||||
description = "Downloads post types from different sites";
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = time;
|
||||
RandomizedDelaySec = delay;
|
||||
Persistent = true;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
"instagram@stories" = downloadTimer "*-*-* 08:12:00" 120 // { };
|
||||
"download@main" = downloadTimer "*-*-* 06,18:02:00" 30 // { };
|
||||
"download@push" = downloadTimer "*:0/5" 30 // { };
|
||||
"download@manga" = downloadTimer "Fri *-*-* 03:08:00" 30 // { };
|
||||
# "download@kemono" = downloadTimer
|
||||
# "*-*-1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31 18:06:00" 60 // { };
|
||||
tuhmayto = {
|
||||
enable = true;
|
||||
description = "Downloads tuhmayto stuff";
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = "*:0/10";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
my.scripts.download = {
|
||||
enable = lib.mkDefault false;
|
||||
install = true;
|
||||
service = false;
|
||||
name = "download";
|
||||
package = download;
|
||||
};
|
||||
};
|
||||
my.scripts.download = {
|
||||
enable = lib.mkDefault false;
|
||||
install = true;
|
||||
service = false;
|
||||
name = "download";
|
||||
package = download;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user