diff --git a/services/go2rtc.nix b/services/go2rtc.nix index fe12cd8..1f8cbc8 100644 --- a/services/go2rtc.nix +++ b/services/go2rtc.nix @@ -1,161 +1,29 @@ { config, pkgs, lib, ... }: -let - sops-nix = builtins.fetchTarball { - url = "https://github.com/Mic92/sops-nix/archive/master.tar.gz"; - }; -in - { - imports = [ - "${sops-nix}/modules/sops" - ]; - config = lib.mkIf (config.networking.hostName == "FredOS-Mediaserver") { + + virtualisation.oci-containers = { + backend = "docker"; + containers."authelia" = { + image = "authelia/authelia:latest"; + volumes = [ + "/home/fred/docker/authelia/config.yml:/config/config.yml:ro" + "/home/fred/docker/authelia/secrets:/secrets:ro" + ]; + ports = [ "9091:9091" ]; + extraOptions = "--restart unless-stopped"; + }; - # Configure sops - sops = { - defaultSopsFile = ../secrets/camera.yaml; - age.keyFile = "/var/lib/sops-nix/key.txt"; - secrets = { - authelia_session_secret = { }; - authelia_encryption_key = { }; - authelia_jwt_secret = { }; - camera_rtsp_url = { }; - fredrik_password_hash = { }; - kayla_password_hash = { }; - }; - }; - - virtualisation.oci-containers = { - backend = "docker"; - - containers."go2rtc" = { - image = "alexxit/go2rtc:latest"; - ports = [ "1984:1984" ]; - volumes = [ - "/var/lib/go2rtc:/config" - ]; - extraOptions = [ - #"--network=nginx-proxy-manager_default" - ]; - }; - - containers."authelia" = { - image = "authelia/authelia:latest"; - ports = [ "9091:9091" ]; - environment = { - TZ = "Europe/London"; - }; - volumes = [ - "/var/lib/authelia:/config" - ]; - extraOptions = [ - #"--network=nginx-proxy-manager_default" - ]; - }; - }; - - systemd.tmpfiles.rules = [ - "d /var/lib/go2rtc 0755 root root -" - "d /var/lib/authelia 0755 root root -" - ]; - - # Generate go2rtc config with secrets - systemd.services.go2rtc-config = { - description = "Generate go2rtc config with secrets"; - wantedBy = [ "docker-go2rtc.service" ]; - before = [ "docker-go2rtc.service" ]; - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - }; - script = '' - mkdir -p /var/lib/go2rtc - cat > /var/lib/go2rtc/go2rtc.yaml < /var/lib/authelia/configuration.yml < /var/lib/authelia/users_database.yml <