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
+317 -342
View File
File diff suppressed because it is too large Load Diff
+29 -54
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,69 +2379,43 @@ in
]; ];
############################ ############################
# swww daemon for the user # Ensure swww daemon runs
############################ ############################
systemd.user.services.swwwDaemon = { services.swww.enable = true;
description = "swww wallpaper daemon";
############################
# User systemd service to sync wallpapers and run script
############################
systemd.user.services.wallpaperSync = {
description = "Sync Wallpapers and run set-wallpapers-at-logon.sh";
wants = [ "graphical-session.target" ];
after = [ "graphical-session.target" ]; after = [ "graphical-session.target" ];
wantedBy = [ "default.target" ];
serviceConfig = {
ExecStart = "${pkgs.swww}/bin/swww daemon";
Restart = "always";
Type = "simple";
};
};
############################ serviceConfig.Type = "oneshot";
# Run the wallpaper script at login serviceConfig.ExecStart = ''
############################ # Ensure destination exists
systemd.user.services.wallpaperSyncLogin = { mkdir -p ${wallpaperDst}
description = "Run wallpaper script at login";
wantedBy = [ "default.target" ]; # Copy wallpapers: overwrite newer files, do not delete existing files
after = [ "swwwDaemon.service" ]; rsync -au --ignore-existing ${wallpaperSrc}/ ${wallpaperDst}/
requires = [ "swwwDaemon.service" ]; rsync -au ${wallpaperSrc}/ ${wallpaperDst}/
serviceConfig = {
Type = "oneshot"; # Execute the logon wallpaper script
Environment = "PATH=/run/current-system/sw/bin:/usr/bin:/bin"; ${scriptFile}
# 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}"; serviceConfig.Restart = "on-failure";
Restart = "on-failure";
};
}; };
############################ ############################
# Timer: run service every 15 minutes # Timer to run the service every 15 minutes
############################ ############################
systemd.user.timers.wallpaperSyncTimer = { systemd.user.timers.wallpaperSyncTimer = {
description = "Run wallpaperSync service every 15 minutes"; description = "Run wallpaperSync service every 15 minutes";
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig.OnBootSec = "1min"; # run soon after login
timerConfig.OnUnitActiveSec = "15min"; timerConfig.OnUnitActiveSec = "15min";
timerConfig.Persistent = true; timerConfig.Persistent = true;
}; };
############################
# Run the script every 15 min
############################
systemd.user.services.wallpaperSync = {
description = "Run wallpaper script periodically";
wantedBy = [ "default.target" ];
after = [ "swwwDaemon.service" ];
requires = [ "swwwDaemon.service" ];
serviceConfig = {
Type = "oneshot";
Environment = "PATH=/run/current-system/sw/bin:/usr/bin:/bin";
ExecStart = "${pkgs.bash}/bin/bash ${scriptFile}";
Restart = "on-failure";
};
};
} }
#+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";
############################
# User systemd service to sync wallpapers and run script
############################
systemd.user.services.wallpaperSync = {
description = "Sync Wallpapers and run set-wallpapers-at-logon.sh";
wants = [ "graphical-session.target" ];
after = [ "graphical-session.target" ]; after = [ "graphical-session.target" ];
wantedBy = [ "default.target" ];
serviceConfig = {
ExecStart = "${pkgs.swww}/bin/swww daemon";
Restart = "always";
Type = "simple";
};
};
############################ serviceConfig.Type = "oneshot";
# Run the wallpaper script at login serviceConfig.ExecStart = ''
############################ # Ensure destination exists
systemd.user.services.wallpaperSyncLogin = { mkdir -p ${wallpaperDst}
description = "Run wallpaper script at login";
wantedBy = [ "default.target" ]; # Copy wallpapers: overwrite newer files, do not delete existing files
after = [ "swwwDaemon.service" ]; rsync -au --ignore-existing ${wallpaperSrc}/ ${wallpaperDst}/
requires = [ "swwwDaemon.service" ]; rsync -au ${wallpaperSrc}/ ${wallpaperDst}/
serviceConfig = {
Type = "oneshot"; # Execute the logon wallpaper script
Environment = "PATH=/run/current-system/sw/bin:/usr/bin:/bin"; ${scriptFile}
# 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}"; serviceConfig.Restart = "on-failure";
Restart = "on-failure";
};
}; };
############################ ############################
# Timer: run service every 15 minutes # Timer to run the service every 15 minutes
############################ ############################
systemd.user.timers.wallpaperSyncTimer = { systemd.user.timers.wallpaperSyncTimer = {
description = "Run wallpaperSync service every 15 minutes"; description = "Run wallpaperSync service every 15 minutes";
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig.OnBootSec = "1min"; # run soon after login
timerConfig.OnUnitActiveSec = "15min"; timerConfig.OnUnitActiveSec = "15min";
timerConfig.Persistent = true; timerConfig.Persistent = true;
}; };
############################
# Run the script every 15 min
############################
systemd.user.services.wallpaperSync = {
description = "Run wallpaper script periodically";
wantedBy = [ "default.target" ];
after = [ "swwwDaemon.service" ];
requires = [ "swwwDaemon.service" ];
serviceConfig = {
Type = "oneshot";
Environment = "PATH=/run/current-system/sw/bin:/usr/bin:/bin";
ExecStart = "${pkgs.bash}/bin/bash ${scriptFile}";
Restart = "on-failure";
};
};
} }