diff --git a/nixosConfigurations/hosts/server.nix b/nixosConfigurations/hosts/server.nix index 460a236..d588401 100755 --- a/nixosConfigurations/hosts/server.nix +++ b/nixosConfigurations/hosts/server.nix @@ -40,16 +40,6 @@ let # { device = "/dev/disk/by-partlabel/disk-main-swap"; } # ]; - users = { - users = { - "${config.xlib.device.username}" = { - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKduJia+unaQQdN6X5syaHvnpIutO+yZwvfiCP4qKQ/P root@sapphira" - ]; - }; - }; - }; - fileSystems = { # External drive "${config.xlib.dirs.server-home}" = { @@ -97,19 +87,6 @@ let SystemMaxUse=512M ''; }; - calibre-web = { - enable = true; - group = "users"; - user = "${config.xlib.device.username}"; - options = { - calibreLibrary = "${config.xlib.dirs.calibre-library}"; - enableBookUploading = true; - enableKepubify = false; - }; - listen.ip = "0.0.0.0"; - listen.port = 8083; - openFirewall = true; - }; openssh = { enable = true; allowSFTP = true; @@ -125,32 +102,6 @@ let UsePAM = true; }; }; - transmission = { - enable = false; - credentialsFile = "${config.xlib.dirs.server-home}/server/transmission/settings.json"; - openRPCPort = true; - package = pkgs.transmission_4; - user = "${config.xlib.device.username}"; - group = "users"; - settings = { - download-dir = "${config.xlib.dirs.server-home}/Downloads"; - incomplete-dir = "${config.xlib.dirs.server-home}/Downloads/Temp"; - incomplete-dir-enabled = true; - rpc-bind-address = "0.0.0.0"; - rpc-port = 9091; - rpc-whitelist-enabled = false; - umask = 0; - }; - }; - syncthing = { - enable = true; - systemService = true; - guiAddress = "0.0.0.0:8384"; - configDir = "${config.xlib.dirs.storage}/Syncthing/${config.xlib.device.hostname}"; - dataDir = "${config.xlib.dirs.server-home}"; - group = "users"; - user = "${config.xlib.device.username}"; - }; }; networking = { diff --git a/nixosConfigurations/hosts/vds.nix b/nixosConfigurations/hosts/vds.nix index 52f6f81..b780362 100755 --- a/nixosConfigurations/hosts/vds.nix +++ b/nixosConfigurations/hosts/vds.nix @@ -46,21 +46,6 @@ let }; }; - users = { - users = { - root = { - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKduJia+unaQQdN6X5syaHvnpIutO+yZwvfiCP4qKQ/P" - ]; - }; - "${config.xlib.device.username}" = { - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKduJia+unaQQdN6X5syaHvnpIutO+yZwvfiCP4qKQ/P" - ]; - }; - }; - }; - services = { earlyoom.enable = true; preload.enable = true; diff --git a/nixosModules/server/calibre-web.nix b/nixosModules/server/calibre-web.nix new file mode 100755 index 0000000..17d02f7 --- /dev/null +++ b/nixosModules/server/calibre-web.nix @@ -0,0 +1,19 @@ +{ + config, + ... +}: +{ + services.calibre-web = { + enable = true; + group = "users"; + user = "${config.xlib.device.username}"; + options = { + calibreLibrary = "${config.xlib.dirs.calibre-library}"; + enableBookUploading = true; + enableKepubify = false; + }; + listen.ip = "0.0.0.0"; + listen.port = 8083; + openFirewall = true; + }; +} diff --git a/nixosModules/server/default.nix b/nixosModules/server/default.nix index 1aab75a..aeab26e 100755 --- a/nixosModules/server/default.nix +++ b/nixosModules/server/default.nix @@ -7,6 +7,7 @@ #./cloudflared.nix #./open-webui.nix ../software/beets + ./calibre-web.nix ./immich.nix ./mealie.nix ./miniflux.nix @@ -14,7 +15,9 @@ ./nginx.nix ./samba.nix ./stirling-pdf.nix + ./syncthing.nix ./systemd.nix + ./transmission.nix ./zerotier.nix ]; } diff --git a/nixosModules/server/samba.nix b/nixosModules/server/samba.nix index fb95022..118ccbf 100755 --- a/nixosModules/server/samba.nix +++ b/nixosModules/server/samba.nix @@ -3,52 +3,50 @@ ... }: { - services = { - samba = { - enable = true; - settings = { - global = { - "invalid users" = [ ]; - "passwd program" = "/run/wrappers/bin/passwd %u"; - security = "user"; - }; - nixos = { - "path" = "/etc/nixos"; - "browseable" = "yes"; - "read only" = "no"; - "valid users" = "${config.xlib.device.username}"; - "guest ok" = "no"; - "writable" = "yes"; - "create mask" = 755; - "directory mask" = 755; - "force user" = "${config.xlib.device.username}"; - "force group" = "users"; - }; - root = { - "path" = "/"; - "browseable" = "yes"; - "read only" = "no"; - "valid users" = "${config.xlib.device.username}"; - "guest ok" = "no"; - "writable" = "yes"; - #"create mask" = 0644; - #"directory mask" = 0644; - "force user" = "root"; - "force group" = "root"; - }; - "${config.xlib.device.username}" = { - "path" = "${config.xlib.dirs.server-home}"; - "browseable" = "yes"; - "read only" = "no"; - "valid users" = "${config.xlib.device.username}"; - "guest ok" = "no"; - "writable" = "yes"; - "create mask" = 700; - "directory mask" = 700; - "force user" = "${config.xlib.device.username}"; - "force group" = "users"; - }; - }; - }; + services.samba = { + enable = true; + settings = { + global = { + "invalid users" = [ ]; + "passwd program" = "/run/wrappers/bin/passwd %u"; + security = "user"; + }; + nixos = { + "path" = "/etc/nixos"; + "browseable" = "yes"; + "read only" = "no"; + "valid users" = "${config.xlib.device.username}"; + "guest ok" = "no"; + "writable" = "yes"; + "create mask" = 755; + "directory mask" = 755; + "force user" = "${config.xlib.device.username}"; + "force group" = "users"; + }; + root = { + "path" = "/"; + "browseable" = "yes"; + "read only" = "no"; + "valid users" = "${config.xlib.device.username}"; + "guest ok" = "no"; + "writable" = "yes"; + #"create mask" = 0644; + #"directory mask" = 0644; + "force user" = "root"; + "force group" = "root"; + }; + "${config.xlib.device.username}" = { + "path" = "${config.xlib.dirs.server-home}"; + "browseable" = "yes"; + "read only" = "no"; + "valid users" = "${config.xlib.device.username}"; + "guest ok" = "no"; + "writable" = "yes"; + "create mask" = 700; + "directory mask" = 700; + "force user" = "${config.xlib.device.username}"; + "force group" = "users"; + }; + }; }; } diff --git a/nixosModules/server/stirling-pdf.nix b/nixosModules/server/stirling-pdf.nix index 0fa3f07..090c632 100644 --- a/nixosModules/server/stirling-pdf.nix +++ b/nixosModules/server/stirling-pdf.nix @@ -1,27 +1,10 @@ { config, - lib, - pkgs, ... }: -# let -# customPackage = pkgs.stirling-pdf.overrideAttrs (oldAttrs: { -# src = pkgs.fetchFromGitHub { -# owner = "Stirling-Tools"; -# repo = "Stirling-PDF"; -# rev = "v1.1.1"; -# sha256 = "0sphh65fdccnajdby9idy5w4zhcnxzzppv2d7zdz203d0lqs6hky"; -# }; -# version = "1.1.1"; -# }); -# in - -# lib.mkIf (config.xlib.device.type == "server") - { services.stirling-pdf = { enable = true; - #package = customPackage; environment = { SERVER_PORT = 6060; }; diff --git a/nixosModules/server/syncthing.nix b/nixosModules/server/syncthing.nix new file mode 100755 index 0000000..9f85eba --- /dev/null +++ b/nixosModules/server/syncthing.nix @@ -0,0 +1,15 @@ +{ + config, + ... +}: +{ + services.syncthing = { + enable = true; + systemService = true; + guiAddress = "0.0.0.0:8384"; + configDir = "${config.xlib.dirs.storage}/Syncthing/${config.xlib.device.hostname}"; + dataDir = "${config.xlib.dirs.server-home}"; + group = "users"; + user = "${config.xlib.device.username}"; + }; +} diff --git a/nixosModules/server/transmission.nix b/nixosModules/server/transmission.nix new file mode 100755 index 0000000..83c7d7e --- /dev/null +++ b/nixosModules/server/transmission.nix @@ -0,0 +1,24 @@ +{ + config, + pkgs, + ... +}: +{ + services.transmission = { + enable = false; + #credentialsFile = "${config.xlib.dirs.server-home}/server/transmission/settings.json"; + openRPCPort = true; + package = pkgs.transmission_4; + user = "${config.xlib.device.username}"; + group = "users"; + settings = { + download-dir = "${config.xlib.dirs.server-home}/Downloads"; + incomplete-dir = "${config.xlib.dirs.server-home}/Downloads/Temp"; + incomplete-dir-enabled = true; + rpc-bind-address = "0.0.0.0"; + rpc-port = 9091; + rpc-whitelist-enabled = false; + umask = 0; + }; + }; +} diff --git a/nixosModules/users.nix b/nixosModules/users.nix index 89c82af..c615d1e 100644 --- a/nixosModules/users.nix +++ b/nixosModules/users.nix @@ -24,6 +24,9 @@ "wheel" "immich" ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKduJia+unaQQdN6X5syaHvnpIutO+yZwvfiCP4qKQ/P" + ]; }; }; };