104 lines
2.3 KiB
Nix
104 lines
2.3 KiB
Nix
{ lib, config, pkgs, flakeRoot, ... }:
|
|
|
|
let
|
|
username = config.defaultUser or "henrov";
|
|
homeDir = "/home/${username}";
|
|
|
|
wallpaperSrc = "${flakeRoot}/assets/traveldroid/copy_2_home/wallpaperstuff";
|
|
wallpaperDst = "${homeDir}/wallpaperstuff";
|
|
in
|
|
{
|
|
#################################
|
|
# System packages (global)
|
|
#################################
|
|
|
|
environment.systemPackages = [
|
|
pkgs.swww
|
|
pkgs.waypaper
|
|
pkgs.rsync
|
|
];
|
|
|
|
#################################
|
|
# Copy editable wallpaper folder
|
|
#################################
|
|
|
|
systemd.services.copyWallpaperStuff = {
|
|
description = "Copy wallpaper assets to user home";
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
};
|
|
|
|
script = ''
|
|
if [ ! -d "${wallpaperDst}" ]; then
|
|
mkdir -p "${wallpaperDst}"
|
|
cp -r ${wallpaperSrc}/* "${wallpaperDst}/"
|
|
fi
|
|
|
|
chown -R ${username}:${username} "${wallpaperDst}"
|
|
chmod -R u+rwx "${wallpaperDst}"
|
|
'';
|
|
};
|
|
|
|
#################################
|
|
# Home Manager integration
|
|
#################################
|
|
|
|
_module.args.hmUsers = {
|
|
${username} = {
|
|
|
|
#################################
|
|
# User packages
|
|
#################################
|
|
|
|
home.packages = [
|
|
pkgs.swww
|
|
pkgs.waypaper
|
|
];
|
|
|
|
#################################
|
|
# swww daemon
|
|
#################################
|
|
|
|
systemd.user.services.swww-daemon = {
|
|
Unit = {
|
|
Description = "swww wallpaper daemon";
|
|
After = [ "graphical-session.target" ];
|
|
};
|
|
|
|
Service = {
|
|
ExecStart = "${pkgs.swww}/bin/swww-daemon";
|
|
Restart = "on-failure";
|
|
};
|
|
|
|
Install = {
|
|
WantedBy = [ "graphical-session.target" ];
|
|
};
|
|
};
|
|
|
|
#################################
|
|
# Set initial wallpaper
|
|
#################################
|
|
|
|
systemd.user.services.swww-init = {
|
|
Unit = {
|
|
Description = "Initialize wallpaper with swww";
|
|
After = [ "swww-daemon.service" ];
|
|
};
|
|
|
|
Service = {
|
|
Type = "oneshot";
|
|
ExecStart = ''
|
|
${pkgs.swww}/bin/swww img ${wallpaperDst}/* --transition-type any
|
|
'';
|
|
};
|
|
|
|
Install = {
|
|
WantedBy = [ "graphical-session.target" ];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|