HASH 8e84af98ac5a
DATE 2025-01-28
SUBJECT syncthing: init
FILES 9 CHANGED
HASH 8e84af98ac5a
DATE 2025-01-28
SUBJECT syncthing: init
FILES 9 CHANGED
┌─ hosts/ooksdesk/default.nix ───────────────────────────────────────────────┐
│ diff --git a/hosts/ooksdesk/default.nix b/hosts/ooksdesk/default.nix │
│ index 8516049..e05050a 100644 │
│ --- a/hosts/ooksdesk/default.nix │
│ +++ b/hosts/ooksdesk/default.nix │
│ @@ -10,6 +10,7 @@ │
│ │
│ ooknet = { │
│ host = { │
│ + syncthing.enable = true; │
│ admin = { │
│ name = "ooks"; │
│ shell = "fish"; │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ hosts/ooksdesk/default.nix ─────────┐
│ diff --git a/hosts/ooksdesk/default.nix b/ho │
│ sts/ooksdesk/default.nix │
│ index 8516049..e05050a 100644 │
│ --- a/hosts/ooksdesk/default.nix │
│ +++ b/hosts/ooksdesk/default.nix │
│ @@ -10,6 +10,7 @@ │
│ │
│ ooknet = { │
│ host = { │
│ + syncthing.enable = true; │
│ admin = { │
│ name = "ooks"; │
│ shell = "fish"; │
└──────────────────────────────────────────────┘
┌─ hosts/ooksmedia/default.nix ──────────────────────────────────────────────┐
│ diff --git a/hosts/ooksmedia/default.nix b/hosts/ooksmedia/default.nix │
│ index e1457bd..9acfcf5 100644 │
│ --- a/hosts/ooksmedia/default.nix │
│ +++ b/hosts/ooksmedia/default.nix │
│ @@ -10,6 +10,7 @@ │
│ │
│ ooknet = { │
│ host = { │
│ + syncthing.enable = true; │
│ admin = { │
│ name = "ooks"; │
│ shell = "fish"; │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ hosts/ooksmedia/default.nix ────────┐
│ diff --git a/hosts/ooksmedia/default.nix b/h │
│ osts/ooksmedia/default.nix │
│ index e1457bd..9acfcf5 100644 │
│ --- a/hosts/ooksmedia/default.nix │
│ +++ b/hosts/ooksmedia/default.nix │
│ @@ -10,6 +10,7 @@ │
│ │
│ ooknet = { │
│ host = { │
│ + syncthing.enable = true; │
│ admin = { │
│ name = "ooks"; │
│ shell = "fish"; │
└──────────────────────────────────────────────┘
┌─ modules/home/workstation/tools/default.nix ───────────────────────────────┐
│ diff --git a/modules/home/workstation/tools/default.nix b/modules/home/workstation │
│ /tools/default.nix │
│ index 8d3b0bc..55cb2b2 100644 │
│ --- a/modules/home/workstation/tools/default.nix │
│ +++ b/modules/home/workstation/tools/default.nix │
│ @@ -9,6 +9,7 @@ │
│ ./kdeconnect.nix │
│ ./ookbrightness.nix │
│ ./zellijMenu.nix │
│ + ./syncthing-applet.nix │
│ ./nemo.nix │
│ ./qtscrcpy.nix │
│ ]; │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ...workstation/tools/default.nix ───┐
│ diff --git a/modules/home/workstation/tools/ │
│ default.nix b/modules/home/workstation/tools │
│ /default.nix │
│ index 8d3b0bc..55cb2b2 100644 │
│ --- a/modules/home/workstation/tools/default │
│ .nix │
│ +++ b/modules/home/workstation/tools/default │
│ .nix │
│ @@ -9,6 +9,7 @@ │
│ ./kdeconnect.nix │
│ ./ookbrightness.nix │
│ ./zellijMenu.nix │
│ + ./syncthing-applet.nix │
│ ./nemo.nix │
│ ./qtscrcpy.nix │
│ ]; │
└──────────────────────────────────────────────┘
┌─ modules/home/workstation/tools/syncthing-applet.nix ──────────────────────┐
│ diff --git a/modules/home/workstation/tools/syncthing-applet.nix b/modules/home/wo │
│ rkstation/tools/syncthing-applet.nix │
│ new file mode 100644 │
│ index 0000000..0fa36f3 │
│ --- /dev/null │
│ +++ b/modules/home/workstation/tools/syncthing-applet.nix │
│ @@ -0,0 +1,15 @@ │
│ +{ │
│ + osConfig, │
│ + pkgs, │
│ + lib, │
│ + ook, │
│ + ... │
│ +}: let │
│ + inherit (lib) mkIf; │
│ + inherit (ook.lib.services) mkTrayService; │
│ + inherit (osConfig.ooknet.host) syncthing; │
│ +in { │
│ + config = mkIf syncthing.enable { │
│ + systemd.user.services."syncthing-applet" = mkTrayService "${pkgs.syncthingtra │
│ y-minimal}/bin/syncthingtray --wait"; │
│ + }; │
│ +} │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ...on/tools/syncthing-applet.nix ───┐
│ diff --git a/modules/home/workstation/tools/ │
│ syncthing-applet.nix b/modules/home/workstat │
│ ion/tools/syncthing-applet.nix │
│ new file mode 100644 │
│ index 0000000..0fa36f3 │
│ --- /dev/null │
│ +++ b/modules/home/workstation/tools/syncthi │
│ ng-applet.nix │
│ @@ -0,0 +1,15 @@ │
│ +{ │
│ + osConfig, │
│ + pkgs, │
│ + lib, │
│ + ook, │
│ + ... │
│ +}: let │
│ + inherit (lib) mkIf; │
│ + inherit (ook.lib.services) mkTrayService; │
│ + inherit (osConfig.ooknet.host) syncthing; │
│ +in { │
│ + config = mkIf syncthing.enable { │
│ + systemd.user.services."syncthing-applet │
│ " = mkTrayService "${pkgs.syncthingtray-mini │
│ mal}/bin/syncthingtray --wait"; │
│ + }; │
│ +} │
└──────────────────────────────────────────────┘
┌─ modules/nixos/base/default.nix ───────────────────────────────────────────┐
│ diff --git a/modules/nixos/base/default.nix b/modules/nixos/base/default.nix │
│ index ca1e4eb..efd876c 100644 │
│ --- a/modules/nixos/base/default.nix │
│ +++ b/modules/nixos/base/default.nix │
│ @@ -11,5 +11,6 @@ │
│ ./tailscale.nix │
│ ./networking.nix │
│ ./security │
│ + ./syncthing.nix │
│ ]; │
│ } │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ modules/nixos/base/default.nix ─────┐
│ diff --git a/modules/nixos/base/default.nix │
│ b/modules/nixos/base/default.nix │
│ index ca1e4eb..efd876c 100644 │
│ --- a/modules/nixos/base/default.nix │
│ +++ b/modules/nixos/base/default.nix │
│ @@ -11,5 +11,6 @@ │
│ ./tailscale.nix │
│ ./networking.nix │
│ ./security │
│ + ./syncthing.nix │
│ ]; │
│ } │
└──────────────────────────────────────────────┘
┌─ modules/nixos/base/nix.nix ───────────────────────────────────────────────┐
│ diff --git a/modules/nixos/base/nix.nix b/modules/nixos/base/nix.nix │
│ index 8af9f9d..2e06c36 100644 │
│ --- a/modules/nixos/base/nix.nix │
│ +++ b/modules/nixos/base/nix.nix │
│ @@ -12,9 +12,9 @@ │
│ flakeInputs = filterAttrs (_: v: isType "flake" v) inputs; │
│ │
│ paths = { │
│ - FLAKE = "/home/${admin.name}/.config/ooknet"; │
│ + FLAKE = "/home/${admin.name}/Summit/ooknet"; │
│ WEBSITE = "${paths.FLAKE}/outputs/pkgs/website"; │
│ - KUNZEN = "/home/${admin.name}/.config/kunzen"; │
│ + KUNZEN = "/home/${admin.name}/Summit/kunzen"; │
│ }; │
│ in { │
│ environment = { │
│ @@ -76,7 +76,5 @@ in { │
│ # nix rebuild utililty │
│ programs.nh = mkIf (role == "workstation") { │
│ enable = true; │
│ - # sets an environment variable FLAKE that nh will refer to by default │
│ - flake = mkIf admin.homeManager "/home/${admin.name}/.config/ooknet"; │
│ }; │
│ } │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ modules/nixos/base/nix.nix ─────────┐
│ diff --git a/modules/nixos/base/nix.nix b/mo │
│ dules/nixos/base/nix.nix │
│ index 8af9f9d..2e06c36 100644 │
│ --- a/modules/nixos/base/nix.nix │
│ +++ b/modules/nixos/base/nix.nix │
│ @@ -12,9 +12,9 @@ │
│ flakeInputs = filterAttrs (_: v: isType " │
│ flake" v) inputs; │
│ │
│ paths = { │
│ - FLAKE = "/home/${admin.name}/.config/oo │
│ knet"; │
│ + FLAKE = "/home/${admin.name}/Summit/ook │
│ net"; │
│ WEBSITE = "${paths.FLAKE}/outputs/pkgs/ │
│ website"; │
│ - KUNZEN = "/home/${admin.name}/.config/k │
│ unzen"; │
│ + KUNZEN = "/home/${admin.name}/Summit/ku │
│ nzen"; │
│ }; │
│ in { │
│ environment = { │
│ @@ -76,7 +76,5 @@ in { │
│ # nix rebuild utililty │
│ programs.nh = mkIf (role == "workstation" │
│ ) { │
│ enable = true; │
│ - # sets an environment variable FLAKE th │
│ at nh will refer to by default │
│ - flake = mkIf admin.homeManager "/home/$ │
│ {admin.name}/.config/ooknet"; │
│ }; │
│ } │
└──────────────────────────────────────────────┘
┌─ modules/nixos/base/options.nix ───────────────────────────────────────────┐
│ diff --git a/modules/nixos/base/options.nix b/modules/nixos/base/options.nix │
│ index 13b2148..ff3fcc6 100644 │
│ --- a/modules/nixos/base/options.nix │
│ +++ b/modules/nixos/base/options.nix │
│ @@ -3,7 +3,7 @@ │
│ pkgs, │
│ ... │
│ }: let │
│ - inherit (lib) mkOption; │
│ + inherit (lib) mkEnableOption mkOption; │
│ inherit (lib.types) str enum bool package; │
│ in { │
│ options.ooknet.host = { │
│ @@ -18,6 +18,10 @@ in { │
│ type = enum ["workstation" "server"]; │
│ }; │
│ │
│ + syncthing = { │
│ + enable = mkEnableOption "Enable syncthing"; │
│ + }; │
│ + │
│ boot = { │
│ loader = mkOption { │
│ type = enum ["systemd" "grub"]; │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ modules/nixos/base/options.nix ─────┐
│ diff --git a/modules/nixos/base/options.nix │
│ b/modules/nixos/base/options.nix │
│ index 13b2148..ff3fcc6 100644 │
│ --- a/modules/nixos/base/options.nix │
│ +++ b/modules/nixos/base/options.nix │
│ @@ -3,7 +3,7 @@ │
│ pkgs, │
│ ... │
│ }: let │
│ - inherit (lib) mkOption; │
│ + inherit (lib) mkEnableOption mkOption; │
│ inherit (lib.types) str enum bool package │
│ ; │
│ in { │
│ options.ooknet.host = { │
│ @@ -18,6 +18,10 @@ in { │
│ type = enum ["workstation" "server"]; │
│ }; │
│ │
│ + syncthing = { │
│ + enable = mkEnableOption "Enable synct │
│ hing"; │
│ + }; │
│ + │
│ boot = { │
│ loader = mkOption { │
│ type = enum ["systemd" "grub"]; │
└──────────────────────────────────────────────┘
┌─ modules/nixos/base/syncthing.nix ─────────────────────────────────────────┐
│ diff --git a/modules/nixos/base/syncthing.nix b/modules/nixos/base/syncthing.nix │
│ new file mode 100644 │
│ index 0000000..1967b32 │
│ --- /dev/null │
│ +++ b/modules/nixos/base/syncthing.nix │
│ @@ -0,0 +1,52 @@ │
│ +{ │
│ + config, │
│ + lib, │
│ + ... │
│ +}: let │
│ + inherit (lib) mkIf; │
│ + inherit (config.networking) hostName; │
│ + inherit (config.ooknet.host) admin syncthing; │
│ + inherit (config.ooknet.secrets) devices; │
│ + │
│ + key = config.age.secrets."${hostName}-syncthing-key"; │
│ + cert = config.age.secrets."${hostName}-syncthing-cert"; │
│ +in { │
│ + config = mkIf syncthing.enable { │
│ + services.syncthing = { │
│ + enable = true; │
│ + user = admin.name; │
│ + group = "users"; │
│ + openDefaultPorts = true; │
│ + configDir = "/home/${admin.name}/.config/syncthing"; │
│ + │
│ + # host credentials │
│ + key = key.path; │
│ + cert = cert.path; │
│ + │
│ + settings = { │
│ + # obfuscating device ids is not necessary, but i do it anyway │
│ + devices = { │
│ + "ooksdesk" = { │
│ + inherit (devices.ooksdesk) id addresses; │
│ + }; │
│ + "ooksmedia" = { │
│ + inherit (devices.ooksmedia) id addresses; │
│ + }; │
│ + }; │
│ + folders = { │
│ + "Summit" = { │
│ + path = "/home/${admin.name}/Summit"; │
│ + devices = [ │
│ + "ooksdesk" │
│ + "ooksmedia" │
│ + ]; │
│ + ignorePerms = false; │
│ + }; │
│ + }; │
│ + }; │
│ + }; │
│ + # Dont create default ~/Sync folder │
│ + # https://wiki.nixos.org/wiki/Syncthing │
│ + systemd.services.syncthing.environment.STNODEFAULTFOLDER = "true"; │
│ + }; │
│ +} │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ modules/nixos/base/syncthing.nix ───┐
│ diff --git a/modules/nixos/base/syncthing.ni │
│ x b/modules/nixos/base/syncthing.nix │
│ new file mode 100644 │
│ index 0000000..1967b32 │
│ --- /dev/null │
│ +++ b/modules/nixos/base/syncthing.nix │
│ @@ -0,0 +1,52 @@ │
│ +{ │
│ + config, │
│ + lib, │
│ + ... │
│ +}: let │
│ + inherit (lib) mkIf; │
│ + inherit (config.networking) hostName; │
│ + inherit (config.ooknet.host) admin syncth │
│ ing; │
│ + inherit (config.ooknet.secrets) devices; │
│ + │
│ + key = config.age.secrets."${hostName}-syn │
│ cthing-key"; │
│ + cert = config.age.secrets."${hostName}-sy │
│ ncthing-cert"; │
│ +in { │
│ + config = mkIf syncthing.enable { │
│ + services.syncthing = { │
│ + enable = true; │
│ + user = admin.name; │
│ + group = "users"; │
│ + openDefaultPorts = true; │
│ + configDir = "/home/${admin.name}/.con │
│ fig/syncthing"; │
│ + │
│ + # host credentials │
│ + key = key.path; │
│ + cert = cert.path; │
│ + │
│ + settings = { │
│ + # obfuscating device ids is not nec │
│ essary, but i do it anyway │
│ + devices = { │
│ + "ooksdesk" = { │
│ + inherit (devices.ooksdesk) id a │
│ ddresses; │
│ + }; │
│ + "ooksmedia" = { │
│ + inherit (devices.ooksmedia) id │
│ addresses; │
│ + }; │
│ + }; │
│ + folders = { │
│ + "Summit" = { │
│ + path = "/home/${admin.name}/Sum │
│ mit"; │
│ + devices = [ │
│ + "ooksdesk" │
│ + "ooksmedia" │
│ + ]; │
│ + ignorePerms = false; │
│ + }; │
│ + }; │
│ + }; │
│ + }; │
│ + # Dont create default ~/Sync folder │
│ + # https://wiki.nixos.org/wiki/Syncthing │
│ + systemd.services.syncthing.environment. │
│ STNODEFAULTFOLDER = "true"; │
│ + }; │
│ +} │
└──────────────────────────────────────────────┘
┌─ outputs/lib/services.nix ─────────────────────────────────────────────────┐
│ diff --git a/outputs/lib/services.nix b/outputs/lib/services.nix │
│ index 648f3e7..a0dedf6 100644 │
│ --- a/outputs/lib/services.nix │
│ +++ b/outputs/lib/services.nix │
│ @@ -7,6 +7,18 @@ │
│ }; │
│ Install.WantedBy = ["graphical-session.target"]; │
│ }; │
│ + │
│ + mkTrayService = exec: { │
│ + Unit = { │
│ + Requires = ["tray.target"]; │
│ + After = ["graphical-session-pre.target" "tray.target"]; │
│ + PartOf = ["graphical-session.target"]; │
│ + }; │
│ + Service = { │
│ + ExecStart = exec; │
│ + }; │
│ + Install = {WantedBy = ["graphical-session.target"];}; │
│ + }; │
│ in { │
│ - inherit mkGraphicalService; │
│ + inherit mkGraphicalService mkTrayService; │
│ } │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ outputs/lib/services.nix ───────────┐
│ diff --git a/outputs/lib/services.nix b/outp │
│ uts/lib/services.nix │
│ index 648f3e7..a0dedf6 100644 │
│ --- a/outputs/lib/services.nix │
│ +++ b/outputs/lib/services.nix │
│ @@ -7,6 +7,18 @@ │
│ }; │
│ Install.WantedBy = ["graphical-session. │
│ target"]; │
│ }; │
│ + │
│ + mkTrayService = exec: { │
│ + Unit = { │
│ + Requires = ["tray.target"]; │
│ + After = ["graphical-session-pre.targe │
│ t" "tray.target"]; │
│ + PartOf = ["graphical-session.target"] │
│ ; │
│ + }; │
│ + Service = { │
│ + ExecStart = exec; │
│ + }; │
│ + Install = {WantedBy = ["graphical-sessi │
│ on.target"];}; │
│ + }; │
│ in { │
│ - inherit mkGraphicalService; │
│ + inherit mkGraphicalService mkTrayService; │
│ } │
└──────────────────────────────────────────────┘
[ BACK TO LOG ]
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET