diff --git a/flake.nix b/flake.nix index c8631b4..386c3a1 100644 --- a/flake.nix +++ b/flake.nix @@ -59,9 +59,12 @@ ./modules/btop.nix ./modules/firefox.nix ./modules/ghostty.nix + ./modules/syncthing.nix ./config/fonts.nix ]; + nixpkgs.config.allowUnfree = true; + home.username = "yanlin"; home.homeDirectory = "/Users/yanlin"; home.stateVersion = "24.05"; @@ -85,6 +88,10 @@ zoxide delta maccy + appcleaner + iina + keepassxc + syncthing ]; programs.home-manager.enable = true; diff --git a/modules/syncthing.nix b/modules/syncthing.nix new file mode 100644 index 0000000..4436fa8 --- /dev/null +++ b/modules/syncthing.nix @@ -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 + ''; +} \ No newline at end of file