From 2ef80de555eca023a406fe515eee3e5223401ae0 Mon Sep 17 00:00:00 2001 From: albert Date: Thu, 21 Nov 2024 23:21:53 +0100 Subject: [PATCH] Syncthing refactor --- nixos/common/services/syncthing-desktop.nix | 45 +++++++++++++++++++++ nixos/common/services/syncthing.nix | 4 +- nixos/hosts/nixos-desktop/default.nix | 2 +- nixos/hosts/nixos-desktop/syncthing.nix | 20 --------- nixos/hosts/nixos-framework/default.nix | 2 +- nixos/hosts/nixos-framework/syncthing.nix | 19 --------- 6 files changed, 50 insertions(+), 42 deletions(-) create mode 100644 nixos/common/services/syncthing-desktop.nix delete mode 100644 nixos/hosts/nixos-desktop/syncthing.nix delete mode 100644 nixos/hosts/nixos-framework/syncthing.nix diff --git a/nixos/common/services/syncthing-desktop.nix b/nixos/common/services/syncthing-desktop.nix new file mode 100644 index 00000000..c4a23bf3 --- /dev/null +++ b/nixos/common/services/syncthing-desktop.nix @@ -0,0 +1,45 @@ +{ username, ... }: { + services.syncthing = { + settings = { + folders = { + "kenshi-saves" = { + id = "kenshi"; + path = "/home/${username}/.steam/steam/steamapps/compatdata/233860/pfx/drive_c/users/steamuser/AppData/Local/kenshi/"; + devices = [ "framework-server" "nixos-desktop" "nixos-framework" ]; + }; + # WoW Addons + "wow-classic-addons" = { + id = "wow-classic-addons"; + path = "/home/${username}/Games/battlenet/drive_c/Program Files (x86)/World of Warcraft/_classic_/Interface/"; + devices = [ "framework-server" "nixos-desktop" "nixos-framework" ]; + }; + "wow-cata-addons" = { + id = "wow-cata-addons"; + path = "/home/${username}/Games/battlenet/drive_c/Program Files (x86)/World of Warcraft/_classic_era_/Interface/"; + devices = [ "framework-server" "nixos-desktop" "nixos-framework" ]; + }; + "wow-retail-addons" = { + id = "wow-retail-addons"; + path = "/home/${username}/Games/battlenet/drive_c/Program Files (x86)/World of Warcraft/_retail_/Interface/"; + devices = [ "framework-server" "nixos-desktop" "nixos-framework" ]; + }; + # WoW WTF + "wow-classic-wtf" = { + id = "wow-classic-wtf"; + path = "/home/${username}/Games/battlenet/drive_c/Program Files (x86)/World of Warcraft/_classic_/WTF/"; + devices = [ "framework-server" "nixos-desktop" "nixos-framework" ]; + }; + "wow-cata-wtf" = { + id = "wow-cata-wtf"; + path = "/home/${username}/Games/battlenet/drive_c/Program Files (x86)/World of Warcraft/_classic_era_/WTF/"; + devices = [ "framework-server" "nixos-desktop" "nixos-framework" ]; + }; + "wow-retail-wtf" = { + id = "wow-retail-wtf"; + path = "/home/${username}/Games/battlenet/drive_c/Program Files (x86)/World of Warcraft/_retail_/WTF/"; + devices = [ "framework-server" "nixos-desktop" "nixos-framework" ]; + }; + }; + }; + }; +} diff --git a/nixos/common/services/syncthing.nix b/nixos/common/services/syncthing.nix index dd9c8913..c493f70f 100644 --- a/nixos/common/services/syncthing.nix +++ b/nixos/common/services/syncthing.nix @@ -1,4 +1,6 @@ -{ username, hostname, deployment_type, ... }: { +{ lib, username, hostname, deployment_type, desktop, ... }: { + + imports = [ ] ++ lib.optional (builtins.isString desktop) ./syncthing-desktop.nix; # Set up the secrets file: sops.secrets."syncthing_cert" = { owner = "root"; diff --git a/nixos/hosts/nixos-desktop/default.nix b/nixos/hosts/nixos-desktop/default.nix index 95e6a5cc..085ab9f7 100644 --- a/nixos/hosts/nixos-desktop/default.nix +++ b/nixos/hosts/nixos-desktop/default.nix @@ -1,7 +1,6 @@ { inputs, config, lib, pkgs, system, ... }: { imports = [ ./disks.nix - ./syncthing.nix ../../common/modules/secureboot.nix # ../../common/modules/yubikey-auth.nix # ../../common/modules/boot.nix @@ -11,6 +10,7 @@ ../../common/services/tailscale-autoconnect.nix ../../common/modules/builder.nix ../../common/services/geoclue.nix + ../../common/services/syncthing.nix ]; #### TEMPORARY TODO #### diff --git a/nixos/hosts/nixos-desktop/syncthing.nix b/nixos/hosts/nixos-desktop/syncthing.nix deleted file mode 100644 index 42d9aa2f..00000000 --- a/nixos/hosts/nixos-desktop/syncthing.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ username, ... }: { - imports = [ ../../common/services/syncthing.nix ]; - - services.syncthing = { - settings = { - folders = { - "kenshi-saves" = { - id = "kenshi"; - path = "/home/${username}/.steam/steam/steamapps/compatdata/233860/pfx/drive_c/users/steamuser/AppData/Local/kenshi/"; - devices = [ "framework-server" "nixos-desktop" "nixos-framework" ]; - }; - "world-of-warcraft" = { - id = "ergcw-ay6yg"; - path = "/home/${username}/Games/battlenet/drive_c/Program Files (x86)/World of Warcraft/"; - devices = [ "framework-server" "nixos-desktop" "nixos-framework" ]; - }; - }; - }; - }; -} diff --git a/nixos/hosts/nixos-framework/default.nix b/nixos/hosts/nixos-framework/default.nix index 477bde5e..ba295d80 100644 --- a/nixos/hosts/nixos-framework/default.nix +++ b/nixos/hosts/nixos-framework/default.nix @@ -3,7 +3,6 @@ inputs.nixos-hardware.nixosModules.framework-13-7040-amd (modulesPath + "/installer/scan/not-detected.nix") ./disks.nix - ./syncthing.nix ../../common/services/tailscale-autoconnect.nix ../../common/modules/secureboot.nix # ../../common/modules/boot.nix @@ -12,6 +11,7 @@ ../../common/modules/builder.nix ../../common/services/podman.nix ../../common/services/geoclue.nix + ../../common/services/syncthing.nix ]; hardware.bluetooth.enable = true; # enables support for Bluetooth diff --git a/nixos/hosts/nixos-framework/syncthing.nix b/nixos/hosts/nixos-framework/syncthing.nix deleted file mode 100644 index f84caefd..00000000 --- a/nixos/hosts/nixos-framework/syncthing.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ username, ... }: { - imports = [ ../../common/services/syncthing.nix ]; - services.syncthing = { - settings = { - folders = { - "kenshi-saves" = { - id = "kenshi"; - path = "/home/${username}/.steam/steam/steamapps/compatdata/233860/pfx/drive_c/users/steamuser/AppData/Local/kenshi/"; - devices = [ "framework-server" "nixos-desktop" "nixos-framework" ]; - }; - "world-of-warcraft" = { - id = "ergcw-ay6yg"; - path = "/home/${username}/Games/battlenet/drive_c/Program Files (x86)/World of Warcraft/"; - devices = [ "framework-server" "nixos-desktop" "nixos-framework" ]; - }; - }; - }; - }; -}