add new syncthing folder

This commit is contained in:
Kopatz
2024-07-01 10:29:39 +02:00
parent 12e275bb04
commit b52af29741
6 changed files with 125 additions and 88 deletions

View File

@@ -24,9 +24,7 @@ in {
};
services = {
displayManager = {
defaultSession = "none+i3";
};
displayManager = { defaultSession = "none+i3"; };
xserver = {
enable = true;
@@ -46,6 +44,24 @@ in {
};
};
security.polkit.enable = true;
systemd = {
user.services.polkit-gnome-authentication-agent-1 = {
description = "polkit-gnome-authentication-agent-1";
wantedBy = [ "graphical-session.target" ];
wants = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig = {
Type = "simple";
ExecStart =
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
};
};
environment.systemPackages = with pkgs; [
picom # compositor
rofi # application

View File

@@ -10,7 +10,7 @@ in {
# Enable OpenGL
hardware.graphics = {
enable = true;
driSupport32Bit = true;
enable32Bit = true;
};
services.xserver.videoDrivers = [ "nvidia" ];

View File

@@ -17,5 +17,6 @@
./kop-fileshare.nix
./adam-site.nix
./plausible.nix
./syncthing.nix
];
}

View File

@@ -1,18 +1,27 @@
{ config, pkgs, lib, ... }:
let basePath = "/synced";
{ config, pkgs, lib, inputs, ... }:
let cfg = config.custom.services.syncthing;
in {
options.custom.services.syncthing = {
enable = lib.mkEnableOption "Enables syncthing";
basePath = lib.mkOption {
type = with lib.types; string;
default = "/synced";
description = "Base path for syncthing data";
};
};
config = lib.mkIf cfg.enable {
systemd.tmpfiles.rules =
[ "d ${basePath} 0700 ${config.mainUser.name} users -" ];
[ "d ${cfg.basePath} 0700 ${config.mainUser.name} users -" ];
# check device id: syncthing cli --gui-address=/synced/gui-socket --gui-apikey=<key> show system
environment.systemPackages = with pkgs; [ syncthing ];
services.syncthing = {
enable = true;
dataDir = basePath;
dataDir = cfg.basePath;
user = config.mainUser.name;
group = "users";
guiAddress = "${basePath}/gui-socket";
guiAddress = "${cfg.basePath}/gui-socket";
overrideDevices = true;
overrideFolders = true;
@@ -56,7 +65,7 @@ in {
};
folders."default" = {
id = "default";
path = "${basePath}/default";
path = "${cfg.basePath}/default";
devices =
[ "kop-pc" "server" "laptop" "mini-pc" "mini-pc-proxmox" "phone" ];
ignorePerms = false;
@@ -64,19 +73,25 @@ in {
folders."books" = {
id = "books";
path = "${basePath}/books";
path = "${cfg.basePath}/books";
devices = [ "kop-pc" "server" "laptop" "mini-pc" "mini-pc-proxmox" ];
};
folders."fh" = {
id = "fh";
path = "${basePath}/fh";
path = "${cfg.basePath}/fh";
devices = [ "kop-pc" "server" "laptop" "mini-pc" "mini-pc-proxmox" ];
};
folders."work_drive" = {
id = "work_drive";
path = "${basePath}/work_drive";
path = "${cfg.basePath}/work_drive";
devices = [ "kop-pc" "server" "laptop" "mini-pc" "mini-pc-proxmox" ];
};
folders."no_backup" = {
id = "no_backup";
path = "${cfg.basePath}/no_backup";
devices = [ "kop-pc" "server" "laptop" "mini-pc" "mini-pc-proxmox" ];
};
};
@@ -84,4 +99,5 @@ in {
networking.firewall.allowedTCPPorts = [ 8384 22000 ];
networking.firewall.allowedUDPPorts = [ 22000 21027 ];
};
}

View File

@@ -9,7 +9,6 @@
./hardware-configuration.nix
../../modules/services/ssh.nix
../../modules/services/step-ca.nix
../../modules/services/syncthing.nix
../../modules/fail2ban.nix
../../modules/logging.nix
../../modules/motd.nix
@@ -86,6 +85,10 @@
ip = "192.168.2.1";
};
adguard.enable = true;
syncthing = {
enable = true;
basePath = "/data/synced";
};
};
nftables.enable = true;
cli-tools.enable = true;

View File

@@ -37,6 +37,7 @@
# server = [ "192.168.0.10" ];
#};
misc = { docker.enable = true; };
services = { syncthing = { enable = true; }; };
hardware = {
android.enable = true;
nvidia.enable = true;
@@ -65,7 +66,7 @@
i3.enable = true;
#hyprland.enable = true;
#gnome.enable = true;
cosmic.enable = true;
#cosmic.enable = true;
shared.enable = true;
stylix.enable = true;
};