diff options
author | Vincent Ambo <tazjin@gmail.com> | 2017-10-16T20·53+0200 |
---|---|---|
committer | Vincent Ambo <tazjin@gmail.com> | 2017-10-16T20·53+0200 |
commit | 202467e9894f4b33186b686d66a4b98a1ac386a8 (patch) | |
tree | 0653d7a340e11fc4389d2454999eb3420d4e593c /wallpapers.nix | |
parent | aa5dcbc4777a8e6f42eaee9ac0301d687363e040 (diff) |
refactor: Move packages & wallpapers config into own nix files
My systems are single-user machines and the package configuration can go in the system-wide package list in full. This splits out the package list into a separate file and also moves the systemd units for wallpaper setting into a separate file.
Diffstat (limited to 'wallpapers.nix')
-rw-r--r-- | wallpapers.nix | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/wallpapers.nix b/wallpapers.nix new file mode 100644 index 000000000000..4faf7ef52c51 --- /dev/null +++ b/wallpapers.nix @@ -0,0 +1,34 @@ +# Configuration for randomly setting wallpapers. +{ config, pkgs, ... }: + +{ + # Configure random setting of wallpapers + systemd.user.services.clone-wallpapers = { + description = "Clone wallpaper repository"; + enable = true; + before = [ "feh-wp.service" "feh-wp.timer" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.fish}/bin/fish -c '${pkgs.coreutils}/bin/stat %h/wallpapers; or ${pkgs.git}/bin/git clone https://git.tazj.in/tazjin/wallpapers.git %h/wallpapers'"; + }; + }; + + systemd.user.services.feh-wp = { + description = "Randomly set wallpaper via feh"; + serviceConfig = { + Type = "oneshot"; + WorkingDirectory = "%h/wallpapers"; + ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.fd}/bin/fd -atf | shuf | head -n1 | ${pkgs.findutils}/bin/xargs ${pkgs.feh}/bin/feh --bg-fill'"; + }; + }; + + systemd.user.timers.feh-wp = { + description = "Set a random wallpaper every hour"; + wantedBy = [ "timers.target" ]; + + timerConfig = { + OnActiveSec = "3second"; + OnUnitActiveSec = "1hour"; + }; + }; +} |