From bdb1ba2249708cae18adf31847b71ddac87b2d67 Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Wed, 16 Jul 2025 10:12:24 -0700 Subject: [PATCH 1/2] Juri, add an account for May --- hosts/juri/users/badtz/user.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 hosts/juri/users/badtz/user.nix diff --git a/hosts/juri/users/badtz/user.nix b/hosts/juri/users/badtz/user.nix new file mode 100644 index 0000000..5972fdb --- /dev/null +++ b/hosts/juri/users/badtz/user.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + fish.enable = true; + git = { + enable = true; + username = "Badtz"; + email = "may@badtz.dev"; + }; +} From 6928d137b385fbce72a6aa3d1847a4993499d6f2 Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Mon, 4 Aug 2025 18:19:58 -0700 Subject: [PATCH 2/2] Syncthing, init syncthing + Juri config --- hosts/juri/host.nix | 18 +++++- nixosModules/services/syncthing/service.nix | 62 +++++++++++++++++++++ 2 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 nixosModules/services/syncthing/service.nix diff --git a/hosts/juri/host.nix b/hosts/juri/host.nix index 192639b..6f5be9a 100644 --- a/hosts/juri/host.nix +++ b/hosts/juri/host.nix @@ -3,8 +3,7 @@ let email = "admin@woach.me"; in { imports = [ - ./hardware.nix - ]; + ./hardware.nix ]; system.stateVersion = "24.11"; system.timezone = "America/Los_Angeles"; system.users.bigWheels = [ "pan" ]; @@ -66,6 +65,21 @@ in { server.domain = "ginko.woach.me"; }; + syncthing = { + enable = true; + devices = { + "homura".id = "NEP24DB-DVXAHTZ-TCCNREQ-Q5TSC7K-ZXPWC4L-5ELGKQX-4I2P47O-2FT5QAU"; + }; + + folders = { + "wiki" = { + path = "/var/lib/wiki"; + devices = [ "homura" ]; + }; + }; + }; + systemd.tmpfiles.rules = [ "d /var/lib/wiki 0755 syncthing syncthing -" ]; + postgres.enable = true; shell.enabledShells = [ "fish" ]; diff --git a/nixosModules/services/syncthing/service.nix b/nixosModules/services/syncthing/service.nix new file mode 100644 index 0000000..72fa7ac --- /dev/null +++ b/nixosModules/services/syncthing/service.nix @@ -0,0 +1,62 @@ +{ config, lib, ... }: + +{ + options.syncthing = { + enable = lib.mkEnableOption "Enables Syncthing service"; + + devices = lib.mkOption { + type = lib.types.attrsOf (lib.types.submodule { + options = { + id = lib.mkOption { + type = lib.types.str; + description = "Device ID"; + }; + addresses = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ "dynamic" ]; + description = "List of device addresses"; + }; + }; + }); + default = {}; + description = "Syncthing devices"; + }; + + folders = lib.mkOption { + type = lib.types.attrsOf (lib.types.submodule { + options = { + path = lib.mkOption { + type = lib.types.path; + description = "Path to folder"; + }; + devices = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = []; + description = "List of device names to share with"; + }; + }; + }); + default = {}; + description = "Syncthing folders"; + }; + }; + + config = lib.mkIf config.syncthing.enable { + services.syncthing = { + enable = true; + openDefaultPorts = true; + + settings = { + devices = lib.mapAttrs (name: device: { + id = device.id; + addresses = device.addresses; + }) config.syncthing.devices; + + folders = lib.mapAttrs (name: folder: { + path = folder.path; + devices = folder.devices; + }) config.syncthing.folders; + }; + }; + }; +}