reworks dnsc-server

This commit is contained in:
Dennis Schoepf 2026-01-15 19:22:55 +01:00
parent 062c286cd2
commit f6c26e53d2
4 changed files with 90 additions and 90 deletions

View file

@ -11,8 +11,11 @@
inputs.home-manager.nixosModules.home-manager
../../modules/docker
../../modules/ups
../../modules/restic
../../modules/samba
../../modules/openssh
../../modules/jellyfin
../../modules/actual-server
];
# General
@ -55,14 +58,6 @@
# Firewall
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [
8384 # Syncthing GUI
22000 # Syncthing
];
networking.firewall.allowedUDPPorts = [
22000 # Syncthing
21027 # Syncthing
];
# My user account
users.users.dennis = {
@ -107,100 +102,21 @@
jellyfin-ffmpeg
usbutils
restic
actual-server
];
# Programs
# GnuPG
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# Root SSH
programs.ssh = {
extraConfig = ''
Host dnsc-storage
AddKeysToAgent yes
Hostname u295965.your-storagebox.de
User u295965
IdentityFile /root/.ssh/id_ed25519
IdentitiesOnly yes
Port 23
'';
};
# Services
# ZFS
services.zfs = {
autoSnapshot.enable = true;
trim.enable = true;
};
# Samba
services.samba = {
enable = true;
openFirewall = true;
settings = {
global = {
"workgroup" = "WORKGROUP";
"security" = "user";
#"use sendfile" = "yes";
#"max protocol" = "smb2";
# note: localhost is the ipv6 localhost ::1
"hosts allow" = "192.168.178. 127.0.0.1 localhost";
"hosts deny" = "0.0.0.0/0";
"guest account" = "nobody";
"map to guest" = "bad user";
};
"share" = {
"path" = "/main/share";
"browseable" = "yes";
"writeable" = "yes";
"read only" = "no";
"guest ok" = "yes";
"force user" = "dennis";
"force group" = "users";
};
};
};
services.samba-wsdd = {
enable = true;
openFirewall = true;
};
services.avahi = {
publish.enable = true;
publish.userServices = true;
nssmdns4 = true;
enable = true;
openFirewall = true;
};
# Tailscale
services.tailscale.enable = true;
# Backups
services.restic.backups = {
"dnsc-storage" = {
initialize = true;
passwordFile = config.age.secrets."restic/password".path;
repository = "sftp:dnsc-storage:restic/dnsc-server";
paths = [
"/home/dennis/notes"
"/main/share"
];
pruneOpts = [
"--keep-last 3"
];
timerConfig = {
onCalendar = "daily";
Persistent = true;
RandomizedDelaySec = "5h";
};
};
};
# Environment variables
environment.variables.EDITOR = "nvim";

View file

@ -0,0 +1,39 @@
{
config,
...
}:
{
# Root SSH
programs.ssh = {
extraConfig = ''
Host dnsc-storage
AddKeysToAgent yes
Hostname u295965.your-storagebox.de
User u295965
IdentityFile /root/.ssh/id_ed25519
IdentitiesOnly yes
Port 23
'';
};
services.restic.backups = {
"dnsc-storage" = {
initialize = true;
passwordFile = config.age.secrets."restic/password".path;
repository = "sftp:dnsc-storage:restic/dnsc-server";
paths = [
"/home/dennis/notes"
"/main/share"
];
pruneOpts = [
"--keep-last 3"
];
timerConfig = {
onCalendar = "daily";
Persistent = true;
RandomizedDelaySec = "5h";
};
};
};
}

45
modules/samba/default.nix Normal file
View file

@ -0,0 +1,45 @@
{ ... }:
{
# Samba
services.samba = {
enable = true;
openFirewall = true;
settings = {
global = {
"workgroup" = "WORKGROUP";
"security" = "user";
#"use sendfile" = "yes";
#"max protocol" = "smb2";
# note: localhost is the ipv6 localhost ::1
"hosts allow" = "192.168.178. 127.0.0.1 localhost";
"hosts deny" = "0.0.0.0/0";
"guest account" = "nobody";
"map to guest" = "bad user";
};
"share" = {
"path" = "/main/share";
"browseable" = "yes";
"writeable" = "yes";
"read only" = "no";
"guest ok" = "yes";
"force user" = "dennis";
"force group" = "users";
};
};
};
services.samba-wsdd = {
enable = true;
openFirewall = true;
};
services.avahi = {
publish.enable = true;
publish.userServices = true;
nssmdns4 = true;
enable = true;
openFirewall = true;
};
}

View file

@ -40,8 +40,8 @@
set -g status-left ""
set -g status-right "#[bg=default,fg=magenta]>> #S << #[bg=default,fg=white]#H "
set -g window-status-current-style bg=default,fg=magenta,bold
set-window-option -g window-status-format " [#I] #W#F "
set-window-option -g window-status-current-format " [#I] #W#F "
set-window-option -g window-status-format " [#I] #W#F "
set-window-option -g window-status-current-format " [#I] #W#F "
set -g pane-border-style fg=#807c9f
set -g pane-active-border-style fg=magenta