From 44ddb7f282c63f8a64ceed14a4aec90b08113bae Mon Sep 17 00:00:00 2001 From: TheK0tYaRa Date: Mon, 9 Mar 2026 08:16:19 +0200 Subject: [PATCH] global sccache doesn't work per user --- home.nix | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/home.nix b/home.nix index 5cb9cc0..eeee234 100644 --- a/home.nix +++ b/home.nix @@ -113,8 +113,8 @@ sessionVariables = { DESKTOP = ":0"; OLLAMA_HOST = "10.20.0.201:11434"; - SCCACHE_DIR="/var/cache/sccache"; - SCCACHE_SERVER_UDS="/run/sccache/server.sock"; + SCCACHE_DIR = "${config.home.homeDirectory}/.cache/sccache"; + SCCACHE_SERVER_UDS = "${config.home.homeDirectory}/.cache/sccache/server.sock"; }; file = { ".config/waybar/power_menu.xml".text = '' @@ -193,6 +193,30 @@ systemd.user = { startServices = "sd-switch"; services = { + sccache = { + Unit = { + Description = "User sccache server"; + }; + Service = { + Environment = [ + "SCCACHE_DIR=${config.home.homeDirectory}/.cache/sccache" + "SCCACHE_SERVER_UDS=${config.home.homeDirectory}/.cache/sccache/server.sock" + "SCCACHE_START_SERVER=1" + "SCCACHE_NO_DAEMON=1" + "SCCACHE_IDLE_TIMEOUT=0" + ]; + ExecStartPre = [ + "${pkgs.coreutils}/bin/mkdir -p ${config.home.homeDirectory}/.cache/sccache" + "${pkgs.coreutils}/bin/rm -f ${config.home.homeDirectory}/.cache/sccache/server.sock" + ]; + ExecStart = "${pkgs.sccache}/bin/sccache"; + Restart = "always"; + RestartSec = 2; + }; + Install = { + WantedBy = [ "default.target" ]; + }; + }; prepare2watch = { Unit = { Description = "prepare videos to get later";