From 40c3297200760e515178bdf849529a7426cb39a2 Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Sun, 20 Oct 2024 17:52:57 +0200 Subject: Home Assistant --- machines/srv3/configuration.nix | 1 + machines/srv3/home-assistant.nix | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 machines/srv3/home-assistant.nix diff --git a/machines/srv3/configuration.nix b/machines/srv3/configuration.nix index d1fb4e2..3e42249 100644 --- a/machines/srv3/configuration.nix +++ b/machines/srv3/configuration.nix @@ -11,6 +11,7 @@ in imports = [ ../../modules/obsidian-livesync.nix + ./home-assistant.nix ./hardware-configuration.nix ./cgit.nix ./noip.nix diff --git a/machines/srv3/home-assistant.nix b/machines/srv3/home-assistant.nix new file mode 100644 index 0000000..d8a4d1d --- /dev/null +++ b/machines/srv3/home-assistant.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: +{ + virtualisation.oci-containers = { + backend = "docker"; + containers.homeassistant = { + volumes = [ + "/srv/home-assistant:/config" + "/etc/localtime:/etc/localtime:ro" + "/run/dbus:/run/dbus:ro" + ]; + environment.TZ = "Europe/Warsaw"; + image = "ghcr.io/home-assistant/home-assistant:stable"; # Warning: if the tag does not change, the image will not be updated + extraOptions = [ + "--network=host" + ]; + autoStart = true; + }; + }; + networking.firewall.allowedTCPPorts = [ 8123 ]; +} -- cgit 1.4.1 From a15e92fcfa04cf23e15dc0899a6578a3e664b2ee Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Wed, 30 Oct 2024 19:26:05 +0100 Subject: Add webdav --- machines/srv3/configuration.nix | 4 ++++ machines/srv3/webdav.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 machines/srv3/webdav.nix diff --git a/machines/srv3/configuration.nix b/machines/srv3/configuration.nix index 3e42249..15f1a15 100644 --- a/machines/srv3/configuration.nix +++ b/machines/srv3/configuration.nix @@ -13,6 +13,7 @@ in ../../modules/obsidian-livesync.nix ./home-assistant.nix ./hardware-configuration.nix + ./webdav.nix ./cgit.nix ./noip.nix ]; @@ -166,6 +167,9 @@ in autoindex on; } ''; + locations."/harcdzielnia/" = { + return = "301 https://harcdzielnia.niedzwiedzinski.cyou"; + }; }; "help.niedzwiedzinski.cyou" = { enableACME = true; diff --git a/machines/srv3/webdav.nix b/machines/srv3/webdav.nix new file mode 100644 index 0000000..9a4c126 --- /dev/null +++ b/machines/srv3/webdav.nix @@ -0,0 +1,33 @@ +{ pkgs, ... }: +let + port = "6060"; +in +{ + services.nginx.virtualHosts."files.niedzwiedzinski.cyou" = { + forceSSL = true; + enableACME = true; + + locations."/" = { + proxyPass = "http://localhost:${port}"; + }; + }; + + services.webdav = { + enable = true; + configFile = "/etc/webdav.yaml"; + #settings = { + #address = "0.0.0.0"; + #port = port; + #scope = "/srv/files"; + #modify = true; + #auth = true; + #users = [ + #{ + #username = "patryk"; + #password = "test"; + #} + #]; + #}; + }; + +} -- cgit 1.4.1