Add a few macOS software
This commit is contained in:
parent
61205c381d
commit
ad3c49cb5f
2 changed files with 36 additions and 0 deletions
29
modules/syncthing.nix
Normal file
29
modules/syncthing.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
# Enable Syncthing service
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
# Don't enable tray on macOS as it requires additional setup
|
||||
tray.enable = false;
|
||||
};
|
||||
|
||||
# Copy existing Syncthing configuration to preserve device ID and settings
|
||||
home.activation.syncthingConfig = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||
# Create syncthing config directory if it doesn't exist
|
||||
mkdir -p "$HOME/.config/syncthing"
|
||||
|
||||
# Copy configuration from macOS location if not already present
|
||||
if [ ! -e "$HOME/.config/syncthing/config.xml" ]; then
|
||||
echo "Migrating Syncthing configuration from macOS location..."
|
||||
if [ -d "$HOME/Library/Application Support/Syncthing" ]; then
|
||||
cp -r "$HOME/Library/Application Support/Syncthing/"* "$HOME/.config/syncthing/"
|
||||
echo "Syncthing configuration migrated successfully!"
|
||||
else
|
||||
echo "Warning: No existing Syncthing configuration found to migrate"
|
||||
fi
|
||||
else
|
||||
echo "Syncthing configuration already exists at ~/.config/syncthing"
|
||||
fi
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue