Regenerated

This commit is contained in:
2026-03-29 13:15:27 +00:00
parent 68b4ed222f
commit 699a351441
3 changed files with 402 additions and 477 deletions
+326 -351
View File
File diff suppressed because it is too large Load Diff
+38 -63
View File
@@ -2358,17 +2358,18 @@ workspace {
** =generated/modules/traveldroid/desktop/wallpaper.nix= ** =generated/modules/traveldroid/desktop/wallpaper.nix=
Setting up wallpaper engine + wallpaper gui Setting up wallpaper engine + wallpaper gui
#+BEGIN_SRC nix :tangle generated/modules/traveldroid/desktop/wallpaper.nix :noweb yes :mkdirp yes :eval never #+BEGIN_SRC nix :tangle generated/modules/traveldroid/desktop/wallpaper.nix :noweb yes :mkdirp yes :eval never
{ config, pkgs, flakeRoot, ... }: { config, pkgs, lib, flakeRoot, ... }:
let let
username = config.defaultUser or "henrov"; username = config.users.users."traveldroid".name or "traveldroid";
homeDir = "/home/${username}"; homeDir = "/home/${username}";
scriptFile = "${homeDir}/Wallpapers/set-wallpapers-at-logon.sh"; wallpaperSrc = "${flakeRoot}/assets/Wallpapers";
socketFile = "/run/user/${config.users.users.${username}.uid or 1000}/wayland-1-swww-daemon.1.sock"; wallpaperDst = "${homeDir}/Wallpapers";
scriptFile = "${wallpaperDst}/set-wallpapers-at-logon.sh";
in in
{ {
############################ ############################
# System-wide packages # Systemwide packages
############################ ############################
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
swww swww
@@ -2378,68 +2379,42 @@ in
]; ];
############################ ############################
# swww daemon for the user # Ensure swww daemon runs
############################ ############################
systemd.user.services.swwwDaemon = { services.swww.enable = true;
description = "swww wallpaper daemon";
after = [ "graphical-session.target" ];
wantedBy = [ "default.target" ];
serviceConfig = {
ExecStart = "${pkgs.swww}/bin/swww daemon";
Restart = "always";
Type = "simple";
};
};
############################ ############################
# Run the wallpaper script at login # User systemd service to sync wallpapers and run script
############################
systemd.user.services.wallpaperSyncLogin = {
description = "Run wallpaper script at login";
wantedBy = [ "default.target" ];
after = [ "swwwDaemon.service" ];
requires = [ "swwwDaemon.service" ];
serviceConfig = {
Type = "oneshot";
Environment = "PATH=/run/current-system/sw/bin:/usr/bin:/bin";
# Wait for the swww socket
ExecStartPre = ''
for i in $(seq 1 10); do
[ -S ${socketFile} ] && exit 0
sleep 0.5
done
echo "swww daemon socket not found, aborting"
exit 1
'';
ExecStart = "${pkgs.bash}/bin/bash ${scriptFile}";
Restart = "on-failure";
};
};
############################
# Timer: run service every 15 minutes
############################
systemd.user.timers.wallpaperSyncTimer = {
description = "Run wallpaperSync service every 15 minutes";
wantedBy = [ "timers.target" ];
timerConfig.OnUnitActiveSec = "15min";
timerConfig.Persistent = true;
};
############################
# Run the script every 15 min
############################ ############################
systemd.user.services.wallpaperSync = { systemd.user.services.wallpaperSync = {
description = "Run wallpaper script periodically"; description = "Sync Wallpapers and run set-wallpapers-at-logon.sh";
wantedBy = [ "default.target" ]; wants = [ "graphical-session.target" ];
after = [ "swwwDaemon.service" ]; after = [ "graphical-session.target" ];
requires = [ "swwwDaemon.service" ];
serviceConfig = { serviceConfig.Type = "oneshot";
Type = "oneshot"; serviceConfig.ExecStart = ''
Environment = "PATH=/run/current-system/sw/bin:/usr/bin:/bin"; # Ensure destination exists
ExecStart = "${pkgs.bash}/bin/bash ${scriptFile}"; mkdir -p ${wallpaperDst}
Restart = "on-failure";
}; # Copy wallpapers: overwrite newer files, do not delete existing files
rsync -au --ignore-existing ${wallpaperSrc}/ ${wallpaperDst}/
rsync -au ${wallpaperSrc}/ ${wallpaperDst}/
# Execute the logon wallpaper script
${scriptFile}
'';
serviceConfig.Restart = "on-failure";
};
############################
# Timer to run the service every 15 minutes
############################
systemd.user.timers.wallpaperSyncTimer = {
description = "Run wallpaperSync service every 15 minutes";
wantedBy = [ "timers.target" ];
timerConfig.OnBootSec = "1min"; # run soon after login
timerConfig.OnUnitActiveSec = "15min";
timerConfig.Persistent = true;
}; };
} }
#+END_SRC #+END_SRC
@@ -1,14 +1,15 @@
{ config, pkgs, flakeRoot, ... }: { config, pkgs, lib, flakeRoot, ... }:
let let
username = config.defaultUser or "henrov"; username = config.users.users."traveldroid".name or "traveldroid";
homeDir = "/home/${username}"; homeDir = "/home/${username}";
scriptFile = "${homeDir}/Wallpapers/set-wallpapers-at-logon.sh"; wallpaperSrc = "${flakeRoot}/assets/Wallpapers";
socketFile = "/run/user/${config.users.users.${username}.uid or 1000}/wayland-1-swww-daemon.1.sock"; wallpaperDst = "${homeDir}/Wallpapers";
scriptFile = "${wallpaperDst}/set-wallpapers-at-logon.sh";
in in
{ {
############################ ############################
# System-wide packages # Systemwide packages
############################ ############################
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
swww swww
@@ -18,67 +19,41 @@ in
]; ];
############################ ############################
# swww daemon for the user # Ensure swww daemon runs
############################ ############################
systemd.user.services.swwwDaemon = { services.swww.enable = true;
description = "swww wallpaper daemon";
after = [ "graphical-session.target" ];
wantedBy = [ "default.target" ];
serviceConfig = {
ExecStart = "${pkgs.swww}/bin/swww daemon";
Restart = "always";
Type = "simple";
};
};
############################ ############################
# Run the wallpaper script at login # User systemd service to sync wallpapers and run script
############################
systemd.user.services.wallpaperSyncLogin = {
description = "Run wallpaper script at login";
wantedBy = [ "default.target" ];
after = [ "swwwDaemon.service" ];
requires = [ "swwwDaemon.service" ];
serviceConfig = {
Type = "oneshot";
Environment = "PATH=/run/current-system/sw/bin:/usr/bin:/bin";
# Wait for the swww socket
ExecStartPre = ''
for i in $(seq 1 10); do
[ -S ${socketFile} ] && exit 0
sleep 0.5
done
echo "swww daemon socket not found, aborting"
exit 1
'';
ExecStart = "${pkgs.bash}/bin/bash ${scriptFile}";
Restart = "on-failure";
};
};
############################
# Timer: run service every 15 minutes
############################
systemd.user.timers.wallpaperSyncTimer = {
description = "Run wallpaperSync service every 15 minutes";
wantedBy = [ "timers.target" ];
timerConfig.OnUnitActiveSec = "15min";
timerConfig.Persistent = true;
};
############################
# Run the script every 15 min
############################ ############################
systemd.user.services.wallpaperSync = { systemd.user.services.wallpaperSync = {
description = "Run wallpaper script periodically"; description = "Sync Wallpapers and run set-wallpapers-at-logon.sh";
wantedBy = [ "default.target" ]; wants = [ "graphical-session.target" ];
after = [ "swwwDaemon.service" ]; after = [ "graphical-session.target" ];
requires = [ "swwwDaemon.service" ];
serviceConfig = { serviceConfig.Type = "oneshot";
Type = "oneshot"; serviceConfig.ExecStart = ''
Environment = "PATH=/run/current-system/sw/bin:/usr/bin:/bin"; # Ensure destination exists
ExecStart = "${pkgs.bash}/bin/bash ${scriptFile}"; mkdir -p ${wallpaperDst}
Restart = "on-failure";
}; # Copy wallpapers: overwrite newer files, do not delete existing files
rsync -au --ignore-existing ${wallpaperSrc}/ ${wallpaperDst}/
rsync -au ${wallpaperSrc}/ ${wallpaperDst}/
# Execute the logon wallpaper script
${scriptFile}
'';
serviceConfig.Restart = "on-failure";
};
############################
# Timer to run the service every 15 minutes
############################
systemd.user.timers.wallpaperSyncTimer = {
description = "Run wallpaperSync service every 15 minutes";
wantedBy = [ "timers.target" ];
timerConfig.OnBootSec = "1min"; # run soon after login
timerConfig.OnUnitActiveSec = "15min";
timerConfig.Persistent = true;
}; };
} }