From 96b66673ecb6b6f2760a22ad77efb077590ab6ca Mon Sep 17 00:00:00 2001 From: h7x4 Date: Tue, 27 May 2025 11:06:33 +0200 Subject: [PATCH] home/modules: start background tasks in background.slice --- home/modules/programs/direnv/auto-prune.nix | 1 + home/modules/programs/gpg/auto-refresh-keys.nix | 1 + home/modules/programs/gpg/auto-update-trust-db.nix | 1 + home/modules/programs/neovim/auto-clean-swapfiles.nix | 1 + home/modules/programs/newsboat/fetch-articles.nix | 1 + home/modules/programs/newsboat/vacuum.nix | 1 + home/modules/programs/nix-index/auto-update-database.nix | 1 + home/modules/programs/prism-launcher/default.nix | 1 + home/modules/services/downloads-sorter.nix | 1 + home/modules/services/mpd.nix | 1 + 10 files changed, 10 insertions(+) diff --git a/home/modules/programs/direnv/auto-prune.nix b/home/modules/programs/direnv/auto-prune.nix index b45b13f..f9f1ce3 100644 --- a/home/modules/programs/direnv/auto-prune.nix +++ b/home/modules/programs/direnv/auto-prune.nix @@ -25,6 +25,7 @@ in Service = { Type = "oneshot"; + Slice = "background.slice"; CPUSchedulingPolicy = "idle"; IOSchedulingClass = "idle"; ExecStart = "${lib.getExe cfg.package} prune"; diff --git a/home/modules/programs/gpg/auto-refresh-keys.nix b/home/modules/programs/gpg/auto-refresh-keys.nix index 3d5ef67..c94c2eb 100644 --- a/home/modules/programs/gpg/auto-refresh-keys.nix +++ b/home/modules/programs/gpg/auto-refresh-keys.nix @@ -32,6 +32,7 @@ in Service = { Type = "oneshot"; + Slice = "background.slice"; CPUSchedulingPolicy = "idle"; IOSchedulingClass = "idle"; ExecStart = "${lib.getExe cfg.package} --refresh-keys"; diff --git a/home/modules/programs/gpg/auto-update-trust-db.nix b/home/modules/programs/gpg/auto-update-trust-db.nix index cb61fb2..d950d58 100644 --- a/home/modules/programs/gpg/auto-update-trust-db.nix +++ b/home/modules/programs/gpg/auto-update-trust-db.nix @@ -32,6 +32,7 @@ in Service = { Type = "oneshot"; + Slice = "background.slice"; CPUSchedulingPolicy = "idle"; IOSchedulingClass = "idle"; ExecStart = "${lib.getExe cfg.package} --update-trustdb"; diff --git a/home/modules/programs/neovim/auto-clean-swapfiles.nix b/home/modules/programs/neovim/auto-clean-swapfiles.nix index da7c155..23d7432 100644 --- a/home/modules/programs/neovim/auto-clean-swapfiles.nix +++ b/home/modules/programs/neovim/auto-clean-swapfiles.nix @@ -31,6 +31,7 @@ in Service = { Type = "oneshot"; + Slice = "background.slice"; CPUSchedulingPolicy = "idle"; IOSchedulingClass = "idle"; ExecStart = lib.getExe (pkgs.writeShellApplication { diff --git a/home/modules/programs/newsboat/fetch-articles.nix b/home/modules/programs/newsboat/fetch-articles.nix index 3546493..d538a6c 100644 --- a/home/modules/programs/newsboat/fetch-articles.nix +++ b/home/modules/programs/newsboat/fetch-articles.nix @@ -26,6 +26,7 @@ in Service = { Type = "oneshot"; + Slice = "background.slice"; CPUSchedulingPolicy = "idle"; IOSchedulingClass = "idle"; ExecStart = "${lib.getExe pkgs.flock} %t/newsboat.lock ${lib.getExe package} --execute=reload"; diff --git a/home/modules/programs/newsboat/vacuum.nix b/home/modules/programs/newsboat/vacuum.nix index 1bc9ffe..7f25d6c 100644 --- a/home/modules/programs/newsboat/vacuum.nix +++ b/home/modules/programs/newsboat/vacuum.nix @@ -25,6 +25,7 @@ in Service = { Type = "oneshot"; + Slice = "background.slice"; CPUSchedulingPolicy = "idle"; IOSchedulingClass = "idle"; ExecStart = "${lib.getExe pkgs.flock} %t/newsboat.lock ${lib.getExe package} --vacuum"; diff --git a/home/modules/programs/nix-index/auto-update-database.nix b/home/modules/programs/nix-index/auto-update-database.nix index 451f9c6..aa0eafa 100644 --- a/home/modules/programs/nix-index/auto-update-database.nix +++ b/home/modules/programs/nix-index/auto-update-database.nix @@ -44,6 +44,7 @@ in Service = { Type = "oneshot"; + Slice = "background.slice"; ExecStart = lib.getExe (pkgs.writeShellApplication { name = "fetch-nix-index-database"; runtimeInputs = with pkgs; [ diff --git a/home/modules/programs/prism-launcher/default.nix b/home/modules/programs/prism-launcher/default.nix index bb2003a..14e3cce 100644 --- a/home/modules/programs/prism-launcher/default.nix +++ b/home/modules/programs/prism-launcher/default.nix @@ -61,6 +61,7 @@ in Unit.Description = "Watchdog that moves screenshots from all prismlauncher minecraft instances into a common dir"; Service = { Type = "oneshot"; + Slice = "background.slice"; ExecStart = lib.getExe (pkgs.writeShellApplication { name = "prismlauncher-move-minecraft-screenshots.sh"; runtimeInputs = with pkgs; [ coreutils findutils ]; diff --git a/home/modules/services/downloads-sorter.nix b/home/modules/services/downloads-sorter.nix index b8a9700..0b7c073 100644 --- a/home/modules/services/downloads-sorter.nix +++ b/home/modules/services/downloads-sorter.nix @@ -115,6 +115,7 @@ in Unit.Description = "Downloads directory watchdog, sorts the downloads directory"; Service = { Type = "oneshot"; + Slice = "background.slice"; SyslogIdentifier = mapping.unitName; ExecStart = let script = pkgs.writeShellApplication { diff --git a/home/modules/services/mpd.nix b/home/modules/services/mpd.nix index 244940f..d560104 100644 --- a/home/modules/services/mpd.nix +++ b/home/modules/services/mpd.nix @@ -36,6 +36,7 @@ in }; Service = { Type = "oneshot"; + Slice = "background.slice"; ExecStart = "${lib.getExe pkgs.mpc-cli} update --wait"; PrivateUsers = true;