diff options
-rw-r--r-- | flake.lock | 17 | ||||
-rw-r--r-- | flake.nix | 6 | ||||
-rw-r--r-- | hosts/iori.nix | 5 | ||||
-rw-r--r-- | hosts/larissa.nix | 5 | ||||
-rw-r--r-- | modules/blog.nix | 29 |
5 files changed, 56 insertions, 6 deletions
@@ -25,6 +25,22 @@ "type": "github" } }, + "blog": { + "flake": false, + "locked": { + "lastModified": 1726451852, + "narHash": "sha256-fde9e17Rr/T1v1Rb5mQe37wl158FFx4csb0haGxivkU=", + "owner": "o-santi", + "repo": "o-santi.github.io", + "rev": "dabdc2f6be7d7ec853263f64ea2acc11536f801f", + "type": "github" + }, + "original": { + "owner": "o-santi", + "repo": "o-santi.github.io", + "type": "github" + } + }, "darwin": { "inputs": { "nixpkgs": [ @@ -252,6 +268,7 @@ "root": { "inputs": { "agenix": "agenix", + "blog": "blog", "emacs-overlay": "emacs-overlay", "firefox-gnome-theme": "firefox-gnome-theme", "from-elisp": "from-elisp", @@ -34,9 +34,13 @@ flake = false; }; mixrank.url = "path:///home/leonardo/mx/mixrank"; + blog = { + url = "github:o-santi/o-santi.github.io"; + flake = false; + }; }; - outputs = { self, nixpkgs, home-manager, agenix, mixrank, ... } @ inputs : + outputs = { self, nixpkgs, ... } @ inputs : let inherit (builtins) readDir attrNames listToAttrs split head; modules = map (p: import ./modules/${p}) (attrNames (readDir ./modules)); diff --git a/hosts/iori.nix b/hosts/iori.nix index 896f836..e4839c5 100644 --- a/hosts/iori.nix +++ b/hosts/iori.nix @@ -14,7 +14,10 @@ default-user.enable = true; basic.enable = true; font-config.enable = false; - services.ddns.enable = true; + services = { + ddns.enable = true; + blog.enable = true; + }; }; boot = { diff --git a/hosts/larissa.nix b/hosts/larissa.nix index 80f496b..ca41367 100644 --- a/hosts/larissa.nix +++ b/hosts/larissa.nix @@ -9,10 +9,7 @@ (modulesPath + "/installer/scan/not-detected.nix") ]; - santi-modules = { - desktop-environment.enable = true; - services.ddns.enable = true; - }; + santi-modules.desktop-environment.enable = true; # Bootloader. boot = { loader.systemd-boot.enable = true; 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; + }; + }; +} |