summaryrefslogtreecommitdiff
path: root/nixos/modules/homelab
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/homelab')
-rw-r--r--nixos/modules/homelab/cloud/default.nix6
-rw-r--r--nixos/modules/homelab/cloud/syncthing.nix35
-rw-r--r--nixos/modules/homelab/core/default.nix6
-rw-r--r--nixos/modules/homelab/core/ssh.nix17
4 files changed, 61 insertions, 3 deletions
diff --git a/nixos/modules/homelab/cloud/default.nix b/nixos/modules/homelab/cloud/default.nix
index d4ee9df..24b067d 100644
--- a/nixos/modules/homelab/cloud/default.nix
+++ b/nixos/modules/homelab/cloud/default.nix
@@ -1 +1,5 @@
-{config, pkgs, lib, ...}: {}
+{...}: {
+ imports = [
+ ./syncthing.nix
+ ];
+}
diff --git a/nixos/modules/homelab/cloud/syncthing.nix b/nixos/modules/homelab/cloud/syncthing.nix
index 993cf42..00328f7 100644
--- a/nixos/modules/homelab/cloud/syncthing.nix
+++ b/nixos/modules/homelab/cloud/syncthing.nix
@@ -3,6 +3,39 @@
in {
options.homelab.cloud.syncthing = {
enable = lib.mkEnableOption "syncthing";
-
+ user = lib.mkOption {
+ type = lib.types.str;
+ description = "The username of syncthing's user";
+ };
+ };
+ config = lib.mkIf cfg.enable {
+ services.syncthing = {
+ enable = true;
+ user = cfg.user;
+ dataDir = "/home/${cfg.user}/Sync";
+ configDir = "/home/${cfg.user}/.config/syncthing";
+ overrideDevices = true;
+ overrideFolders = true;
+ settings = {
+ devices = {
+ "ideapad-laptop" = {
+ id = "62SPMAK-NOHX3QT-MVSOS7U-UON6YPH-HXXNFXO-PRSAJ2X-GYXFWJO-6LARPQL";
+ };
+ "nzxt-desktop" = {
+ id = "2TPKPXD-LO7OL7V-GP5HOUM-2P5SUEQ-XST4UYJ-S2Z56PP-IM66IIT-GLUNLAX";
+ };
+ "samsung-tablet" = {
+ id = "ZKL25GJ-TKM2E6Y-VQSBAW5-TVG7RWM-RRAUEVA-ZOJZNCM-F3ARZUU-TPK7CA6";
+ };
+ };
+ folders = {
+ "Main" = {
+ path = "/home/${cfg.user}/Sync";
+ devices = [ "ideapad-laptop" "nzxt-desktop" "samsung-tablet" ];
+ };
+ };
+ };
+ };
+ environment.systemPackages = [ pkgs.syncthing ];
};
}
diff --git a/nixos/modules/homelab/core/default.nix b/nixos/modules/homelab/core/default.nix
index d4ee9df..f2202aa 100644
--- a/nixos/modules/homelab/core/default.nix
+++ b/nixos/modules/homelab/core/default.nix
@@ -1 +1,5 @@
-{config, pkgs, lib, ...}: {}
+{...}: {
+ imports = [
+ ./ssh.nix
+ ];
+}
diff --git a/nixos/modules/homelab/core/ssh.nix b/nixos/modules/homelab/core/ssh.nix
new file mode 100644
index 0000000..1b4b559
--- /dev/null
+++ b/nixos/modules/homelab/core/ssh.nix
@@ -0,0 +1,17 @@
+{config, lib, ...}: let
+ cfg = config.homelab.core.ssh;
+in {
+ options.homelab.core.ssh = {
+ enable = lib.mkEnableOption "ssh";
+ };
+ config = lib.mkIf cfg.enable {
+ services.openssh = {
+ enable = true;
+ ports = [ 2200 ];
+ settings = {
+ PermitRootLogin = "no";
+ PasswordAuthentication = false;
+ };
+ };
+ };
+}