From 1d5435b49e4d92f725c0bf9db8c6d6a9cdbaf500 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Sun, 25 Dec 2022 12:07:38 +0100 Subject: [PATCH] service/tandoor-recipes: init --- machines/newton/services.nix | 4 ++ modules/services/default.nix | 1 + modules/services/tandoor-recipes/default.nix | 41 ++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 modules/services/tandoor-recipes/default.nix diff --git a/machines/newton/services.nix b/machines/newton/services.nix index 9b61d54..64640fe 100644 --- a/machines/newton/services.nix +++ b/machines/newton/services.nix @@ -65,6 +65,10 @@ in ssh-server = { enable = true; }; + # self-hosted recipe manager + tandoor-recipes = { + enable = true; + }; # Webserver nginx = { enable = true; diff --git a/modules/services/default.nix b/modules/services/default.nix index 7fc4331..e4d050d 100644 --- a/modules/services/default.nix +++ b/modules/services/default.nix @@ -18,6 +18,7 @@ ./passworts ./rss-bridge ./ssh-server + ./tandoor-recipes ]; } diff --git a/modules/services/tandoor-recipes/default.nix b/modules/services/tandoor-recipes/default.nix new file mode 100644 index 0000000..e8a80d7 --- /dev/null +++ b/modules/services/tandoor-recipes/default.nix @@ -0,0 +1,41 @@ +# self-hosted recipe manager +{ config, lib, ... }: +let + cfg = config.my.services.tandoor-recipes; + domain = config.networking.domain; +in +{ + options.my.services.tandoor-recipes = with lib; { + enable = mkEnableOption "Tandoor Recipes"; + port = mkOption { + type = types.port; + default = 8089; + example = 8080; + description = "Internal port"; + }; + }; + + config = lib.mkIf cfg.enable { + services.tandoor-recipes = { + enable = true; + port = cfg.port; + }; + + # Proxy to Tandoor-Recipes + my.services.nginx.virtualHosts = [ + { + subdomain = "recipes"; + inherit (cfg) port; + } + ]; + + webapps.apps.tandoor-recipes = { + dashboard = { + name = "Recipes"; + category = "app"; + icon = "utensils"; + link = "https://recipes.${domain}"; + }; + }; + }; +}