mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-05 16:41:04 +01:00
ludusavi: use config.xdg.stateHome instead of $XDG_STATE_HOME
This commit is contained in:
parent
db44f38047
commit
eca5f967cd
1 changed files with 28 additions and 2 deletions
|
|
@ -47,11 +47,19 @@ in
|
|||
settings = lib.mkOption {
|
||||
type = settingsFormat.type;
|
||||
default = {
|
||||
manifest.url = "https://raw.githubusercontent.com/mtkennerly/ludusavi-manifest/master/data/manifest.yaml";
|
||||
roots = [ ];
|
||||
backup.path = "${config.xdg.stateHome}/backups/ludusavi";
|
||||
restore.path = "${config.xdg.stateHome}/backups/ludusavi";
|
||||
};
|
||||
defaultText = ''
|
||||
{
|
||||
manifest.url = "https://raw.githubusercontent.com/mtkennerly/ludusavi-manifest/master/data/manifest.yaml";
|
||||
roots = [ ];
|
||||
backup.path = "$XDG_STATE_HOME/backups/ludusavi";
|
||||
restore.path = "$XDG_STATE_HOME/backups/ludusavi";
|
||||
};
|
||||
}
|
||||
'';
|
||||
example = {
|
||||
language = "en-US";
|
||||
theme = "light";
|
||||
|
|
@ -94,6 +102,24 @@ in
|
|||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${lib.getExe cfg.package} backup --force";
|
||||
ExecStartPre = "${pkgs.writeShellScript "ludusavi-migrate-backup" ''
|
||||
old_base_dir="${config.home.homeDirectory}/\$XDG_STATE_HOME"
|
||||
old_dir="$old_base_dir/backups/ludusavi"
|
||||
new_base_dir="${config.xdg.stateHome}/backups"
|
||||
new_dir="$new_base_dir/ludusavi"
|
||||
|
||||
if [[ -d "$old_base_dir" ]]; then
|
||||
echo "Migrating old Ludusavi's backup... (See home-manager/#8234)"
|
||||
if [[ ! -d "$new_base_dir" ]]; then
|
||||
mkdir -p "$new_base_dir"
|
||||
fi
|
||||
|
||||
mv "$old_dir" "$new_dir"
|
||||
rmdir "$old_base_dir/backups"
|
||||
rmdir "$old_base_dir"
|
||||
echo "Migration completed successfully."
|
||||
fi
|
||||
''}";
|
||||
}
|
||||
// lib.optionalAttrs cfg.backupNotification {
|
||||
ExecStartPost = "${lib.getExe pkgs.libnotify} 'Ludusavi' 'Backup completed' -i com.mtkennerly.ludusavi -a 'Ludusavi'";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue