syncthing: init
This commit is contained in:
parent
84849d5b2d
commit
8e84af98ac
9 changed files with 91 additions and 6 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
ooknet = {
|
ooknet = {
|
||||||
host = {
|
host = {
|
||||||
|
syncthing.enable = true;
|
||||||
admin = {
|
admin = {
|
||||||
name = "ooks";
|
name = "ooks";
|
||||||
shell = "fish";
|
shell = "fish";
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
ooknet = {
|
ooknet = {
|
||||||
host = {
|
host = {
|
||||||
|
syncthing.enable = true;
|
||||||
admin = {
|
admin = {
|
||||||
name = "ooks";
|
name = "ooks";
|
||||||
shell = "fish";
|
shell = "fish";
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
./kdeconnect.nix
|
./kdeconnect.nix
|
||||||
./ookbrightness.nix
|
./ookbrightness.nix
|
||||||
./zellijMenu.nix
|
./zellijMenu.nix
|
||||||
|
./syncthing-applet.nix
|
||||||
./nemo.nix
|
./nemo.nix
|
||||||
./qtscrcpy.nix
|
./qtscrcpy.nix
|
||||||
];
|
];
|
||||||
|
|
|
||||||
15
modules/home/workstation/tools/syncthing-applet.nix
Normal file
15
modules/home/workstation/tools/syncthing-applet.nix
Normal file
|
|
@ -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-minimal}/bin/syncthingtray --wait";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -11,5 +11,6 @@
|
||||||
./tailscale.nix
|
./tailscale.nix
|
||||||
./networking.nix
|
./networking.nix
|
||||||
./security
|
./security
|
||||||
|
./syncthing.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@
|
||||||
flakeInputs = filterAttrs (_: v: isType "flake" v) inputs;
|
flakeInputs = filterAttrs (_: v: isType "flake" v) inputs;
|
||||||
|
|
||||||
paths = {
|
paths = {
|
||||||
FLAKE = "/home/${admin.name}/.config/ooknet";
|
FLAKE = "/home/${admin.name}/Summit/ooknet";
|
||||||
WEBSITE = "${paths.FLAKE}/outputs/pkgs/website";
|
WEBSITE = "${paths.FLAKE}/outputs/pkgs/website";
|
||||||
KUNZEN = "/home/${admin.name}/.config/kunzen";
|
KUNZEN = "/home/${admin.name}/Summit/kunzen";
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
environment = {
|
environment = {
|
||||||
|
|
@ -76,7 +76,5 @@ in {
|
||||||
# nix rebuild utililty
|
# nix rebuild utililty
|
||||||
programs.nh = mkIf (role == "workstation") {
|
programs.nh = mkIf (role == "workstation") {
|
||||||
enable = true;
|
enable = true;
|
||||||
# sets an environment variable FLAKE that nh will refer to by default
|
|
||||||
flake = mkIf admin.homeManager "/home/${admin.name}/.config/ooknet";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkOption;
|
inherit (lib) mkEnableOption mkOption;
|
||||||
inherit (lib.types) str enum bool package;
|
inherit (lib.types) str enum bool package;
|
||||||
in {
|
in {
|
||||||
options.ooknet.host = {
|
options.ooknet.host = {
|
||||||
|
|
@ -18,6 +18,10 @@ in {
|
||||||
type = enum ["workstation" "server"];
|
type = enum ["workstation" "server"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
syncthing = {
|
||||||
|
enable = mkEnableOption "Enable syncthing";
|
||||||
|
};
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
loader = mkOption {
|
loader = mkOption {
|
||||||
type = enum ["systemd" "grub"];
|
type = enum ["systemd" "grub"];
|
||||||
|
|
|
||||||
52
modules/nixos/base/syncthing.nix
Normal file
52
modules/nixos/base/syncthing.nix
Normal file
|
|
@ -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";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -7,6 +7,18 @@
|
||||||
};
|
};
|
||||||
Install.WantedBy = ["graphical-session.target"];
|
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 {
|
in {
|
||||||
inherit mkGraphicalService;
|
inherit mkGraphicalService mkTrayService;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue