diff --git a/common/default.nix b/common/default.nix index b192f8f..6048752 100644 --- a/common/default.nix +++ b/common/default.nix @@ -57,6 +57,7 @@ shell = pkgs.fish; openssh.authorizedKeys.keys = (import ./ssh.nix).users; hashedPassword = "$6$TuDO46rILr$gkPUuLKZe3psexhs8WFZMpzgEBGksE.c3Tjh1f8sD0KMC4oV89K2pqAABfl.Lpxu2jVdr5bgvR5cWnZRnji/r/"; + uid = 1000; }; nix.trustedUsers = [ "root" "googlebot" ]; diff --git a/common/hosts.nix b/common/hosts.nix index 52e39f8..87ab730 100644 --- a/common/hosts.nix +++ b/common/hosts.nix @@ -3,6 +3,11 @@ let system = (import ./ssh.nix).system; in { + networking.hosts = { + # some DNS providers filter local ip results from DNS request + "172.30.145.180" = [ "s0.zt.neet.dev" ]; + }; + programs.ssh.knownHosts = { liza = { hostNames = [ "liza" "liza.neet.dev" ]; diff --git a/common/pc/default.nix b/common/pc/default.nix index 99918ab..259856f 100644 --- a/common/pc/default.nix +++ b/common/pc/default.nix @@ -17,6 +17,7 @@ in { ./discord.nix ./steam.nix ./touchpad.nix + ./mount-samba.nix ]; options.de = { diff --git a/common/pc/mount-samba.nix b/common/pc/mount-samba.nix new file mode 100644 index 0000000..e84c88a --- /dev/null +++ b/common/pc/mount-samba.nix @@ -0,0 +1,36 @@ +# mounts the samba share on s0 over zeroteir + +{ config, lib, ... }: + +let + cfg = config.services.mount-samba; + + # prevents hanging on network split + network_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s"; + + user_opts = "uid=${toString config.users.users.googlebot.uid},file_mode=0660,dir_mode=0770,user"; + auth_opts = "credentials=/run/agenix/smb-secrets"; + version_opts = "vers=2.1"; + + opts = "${network_opts},${user_opts},${version_opts}"; +in { + options.services.mount-samba = { + enable = lib.mkEnableOption "enable mounting samba shares"; + }; + + config = lib.mkIf (cfg.enable && config.services.zerotierone.enable) { + fileSystems."/mnt/public" = { + device = "//s0.zt.neet.dev/public"; + fsType = "cifs"; + options = ["guest,${opts}"]; + }; + + fileSystems."/mnt/private" = { + device = "//s0.zt.neet.dev/googlebot"; + fsType = "cifs"; + options = ["${auth_opts},${opts}"]; + }; + + age.secrets.smb-secrets.file = ../../secrets/smb-secrets.age; + }; +} \ No newline at end of file diff --git a/machines/ray/configuration.nix b/machines/ray/configuration.nix index fbd523c..d5e4b5f 100644 --- a/machines/ray/configuration.nix +++ b/machines/ray/configuration.nix @@ -49,6 +49,8 @@ services.zerotierone.enable = true; + services.mount-samba.enable = true; + de.enable = true; de.touchpad.enable = true; } diff --git a/secrets/secrets.nix b/secrets/secrets.nix index fb0905b..a0d3e7f 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -17,4 +17,5 @@ in "spotifyd.age".publicKeys = all; "wolframalpha.age".publicKeys = all; "cloudflared-navidrome.json.age".publicKeys = all; + "smb-secrets.age".publicKeys = all; } diff --git a/secrets/smb-secrets.age b/secrets/smb-secrets.age new file mode 100644 index 0000000..b4e0ac2 Binary files /dev/null and b/secrets/smb-secrets.age differ