Regenerated
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{ config, pkgs, flakeRoot, ... }:
|
||||
|
||||
let
|
||||
username = config.defaultUser or "henrov";
|
||||
homeDir = "/home/${username}";
|
||||
wallpaperDir = "${homeDir}/Wallpapers";
|
||||
scriptDest = "${homeDir}/Wallpapers/wallpaper-sync-and-set.sh";
|
||||
homeDir = "/home/${config.users.users."traveldroid".name or "traveldroid"}";
|
||||
scriptFile = "${homeDir}/Wallpapers/script/set-wallpapers-at-logon.sh";
|
||||
in
|
||||
{
|
||||
############################
|
||||
# Systemwide packages
|
||||
# System-wide packages
|
||||
############################
|
||||
environment.systemPackages = with pkgs; [
|
||||
swww
|
||||
@@ -18,35 +16,33 @@ in
|
||||
];
|
||||
|
||||
############################
|
||||
# Install the script
|
||||
############################
|
||||
home.file."Wallpapers/wallpaper-sync-and-set.sh".source = ./assets/Wallpapers/wallpaper-sync-and-set.sh;
|
||||
home.file."Wallpapers/wallpaper-sync-and-set.sh".executable = true;
|
||||
|
||||
############################
|
||||
# Systemd user service + timer
|
||||
# User service: run the script
|
||||
############################
|
||||
systemd.user.services.wallpaperSync = {
|
||||
description = "2-way sync wallpapers + set random per workspace";
|
||||
serviceConfig.Type = "oneshot";
|
||||
serviceConfig.ExecStart = "${scriptDest}";
|
||||
serviceConfig.Restart = "on-failure";
|
||||
};
|
||||
description = "Run set-wallpapers-at-logon.sh";
|
||||
|
||||
systemd.user.timers.wallpaperSyncTimer = {
|
||||
description = "Run wallpaper sync every hour";
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig.OnCalendar = "hourly";
|
||||
timerConfig.Persistent = true;
|
||||
serviceConfig.Type = "oneshot";
|
||||
serviceConfig.ExecStart = scriptFile;
|
||||
serviceConfig.Restart = "on-failure";
|
||||
};
|
||||
|
||||
############################
|
||||
# Run at login
|
||||
# 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;
|
||||
};
|
||||
|
||||
############################
|
||||
# Ensure the script runs at login
|
||||
############################
|
||||
systemd.user.services.wallpaperSyncLogin = {
|
||||
description = "Run wallpaper sync at login";
|
||||
serviceConfig.Type = "oneshot";
|
||||
serviceConfig.ExecStart = "${scriptDest}";
|
||||
install.WantedBy = [ "default.target" ];
|
||||
description = "Run wallpaperSync at login";
|
||||
wantedBy = [ "default.target" ];
|
||||
serviceConfig.Type = "oneshot";
|
||||
serviceConfig.ExecStart = scriptFile;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user