summaryrefslogtreecommitdiff
path: root/modules/blog.nix
diff options
context:
space:
mode:
authorLeonardo Santiago <[email protected]>2024-09-16 20:20:16 -0300
committerLeonardo Santiago <[email protected]>2024-09-16 20:20:16 -0300
commitd2f8537695338c6b186bb0d52489c66c6ae83b8d (patch)
tree45b8924912bb9b57006e228d9eb19c64c5ed65b3 /modules/blog.nix
parent1e9b686ae826a5aad1a4aee1db98d3b3d3d437a0 (diff)
add blog module
Diffstat (limited to 'modules/blog.nix')
-rw-r--r--modules/blog.nix29
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/blog.nix b/modules/blog.nix
new file mode 100644
index 0000000..9234f4e
--- /dev/null
+++ b/modules/blog.nix
@@ -0,0 +1,29 @@
+{ config, lib, inputs, pkgs, ... }: with lib; let
+ cfg = config.santi-modules.services.blog;
+ blog = pkgs.stdenv.mkDerivation {
+ name="hugo-blog";
+ src = inputs.blog;
+ buildInputs = [ pkgs.hugo ];
+ buildPhase = ''
+ mkdir $out
+ hugo --destination $out
+ '';
+ };
+in {
+ options.santi-modules.services.blog = {
+ enable = mkEnableOption "Enable blog hosting";
+ url = mkOption {
+ type = types.str;
+ default = "santi.net.br";
+ description = "Url to serve blog on";
+ };
+ };
+ config = mkIf cfg.enable {
+ networking.firewall.allowedTCPPorts = [ 80 ];
+ # TODO: enable SSL
+ services.nginx = {
+ enable = true;
+ virtualHosts.${cfg.url}.root = blog;
+ };
+ };
+}