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 = { services = {
displayManager = { displayManager = { defaultSession = "none+i3"; };
defaultSession = "none+i3";
};
xserver = { xserver = {
enable = true; 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; [ environment.systemPackages = with pkgs; [
picom # compositor picom # compositor
rofi # application rofi # application

View File

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

View File

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

View File

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

View File

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

View File

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