<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Alexandre Jesus (@adbjesus) - Blog</title>
    <link rel="self" type="application/atom+xml" href="https://adbjesus.com/blog/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://adbjesus.com/blog/"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2023-08-01T00:00:00+00:00</updated>
    <id>https://adbjesus.com/blog/atom.xml</id>
    <entry xml:lang="en">
        <title>Hello, world!</title>
        <published>2022-08-29T00:00:00+00:00</published>
        <updated>2023-08-01T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://adbjesus.com/blog/hello-world/"/>
        <id>https://adbjesus.com/blog/hello-world/</id>
        
        <content type="html" xml:base="https://adbjesus.com/blog/hello-world/">&lt;p&gt;I have been thinking of starting a blog for a while, mostly to write
about stuff that makes no sense to publish academically, but also to
improve my writing skills. I expect to mostly write about Programming,
Emacs, Linux, and other tech topics. But we will see where it goes.&lt;&#x2F;p&gt;
&lt;p&gt;In this first post I will quickly go over the implementation and
deployment of this site. You can find the source code for the website at
&lt;a href=&quot;https:&#x2F;&#x2F;git.adbjesus.com&#x2F;adbjesus.com&quot;&gt;https:&#x2F;&#x2F;git.adbjesus.com&#x2F;adbjesus.com&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;static-site-generator&quot;&gt;Static Site Generator&lt;&#x2F;h3&gt;
&lt;p&gt;Since this site will contain static content, I&#x27;ve decided to go with a
static site generator. In particular, I chose
&lt;a href=&quot;https:&#x2F;&#x2F;getzola.org&quot;&gt;Zola&lt;&#x2F;a&gt;. The main reason for using Zola and not
something else is that I am familiar with its implementation language
(Rust). This can allow me to easily contribute to the project to fix any
issue or scratch any itch.&lt;&#x2F;p&gt;
&lt;p&gt;In terms of styling, I&#x27;m using simple templates and CSS I implemented
myself, which match the light&#x2F;dark system theme option set by the user.
Something I am not yet doing, is using syntax highlighting for code in
blog posts. Although Zola supports this, it does not support some of the
languages that I want, such as Emacs Lisp and Nix, and it is using old
and buggy Sublime syntaxes. There is currently an &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;getzola&#x2F;zola&#x2F;issues&#x2F;1787&quot;&gt;open
issue&lt;&#x2F;a&gt; to replace the
current system. Another option, would be to use a javascript based
syntax highlighter. However, I would rather keep my site
javascript-free. As a result, since I don&#x27;t consider it to be a critical
feature for now, I will not implement any syntax highlighting for the
time being.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-org&quot;&gt;Using Org&lt;&#x2F;h3&gt;
&lt;p&gt;One issue I had with Zola is that it does not suppor
&lt;a href=&quot;https:&#x2F;&#x2F;orgmode.org&quot;&gt;Org&lt;&#x2F;a&gt; for writing content (see this
&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;getzola&#x2F;zola&#x2F;issues&#x2F;909&quot;&gt;issue&lt;&#x2F;a&gt;). However, I would
prefer to use it instead of markdown because I prefer and am more
comfortable with its syntax, but also because I want to be able to use
&lt;a href=&quot;https:&#x2F;&#x2F;orgmode.org&#x2F;worg&#x2F;org-contrib&#x2F;babel&#x2F;&quot;&gt;Org Babel&lt;&#x2F;a&gt; to execute code
within the &lt;code&gt;.org&lt;&#x2F;code&gt; file directly when writing posts for which executing
code is useful.&lt;&#x2F;p&gt;
&lt;p&gt;Nonetheless, this proved not to be an issue for my simple use case
because I can automatically convert &lt;code&gt;.org&lt;&#x2F;code&gt; files to &lt;code&gt;.md&lt;&#x2F;code&gt; files
(following the &lt;a href=&quot;https:&#x2F;&#x2F;commonmark.org&#x2F;&quot;&gt;CommonMark&lt;&#x2F;a&gt; spec) using
&lt;a href=&quot;https:&#x2F;&#x2F;pandoc.org&quot;&gt;pandoc&lt;&#x2F;a&gt;, and the
&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;emacsorphanage&#x2F;ox-pandoc&quot;&gt;ox-pandoc&lt;&#x2F;a&gt; package for
Emacs. To setup ox-pandoc to export &lt;code&gt;.org&lt;&#x2F;code&gt; files to CommonMark I have
the following in my Emacs configuration:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;elisp&quot; class=&quot;language-elisp &quot;&gt;&lt;code class=&quot;language-elisp&quot; data-lang=&quot;elisp&quot;&gt;(use-package ox-pandoc
  :ensure t
  :after org
  :custom
  (org-pandoc-menu-entry
   &amp;#x27;((?c &amp;quot;to cmk.&amp;quot; org-pandoc-export-to-commonmark)
     (?C &amp;quot;to cmk and open.&amp;quot; org-pandoc-export-to-commonmark-and-open))))
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then, I put the &lt;code&gt;index.org&lt;&#x2F;code&gt; for a blog post inside a dedicated folder
for that post:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;example&quot; class=&quot;language-example &quot;&gt;&lt;code class=&quot;language-example&quot; data-lang=&quot;example&quot;&gt;content
└── blog
   └── 01-hello-world
      ├── index.org
      └── ... &amp;#x2F;&amp;#x2F; other files
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;index.org&lt;&#x2F;code&gt; file includes some metadata in its header for both Zola
and ox-pandoc. For example, for this post I&#x27;m using the following
header:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;org&quot; class=&quot;language-org &quot;&gt;&lt;code class=&quot;language-org&quot; data-lang=&quot;org&quot;&gt;#+TITLE: Hello, world!
#+DATE: 2022-08-25
#+PANDOC_METADATA: slug:hello-world
#+PANDOC_EXTENSIONS: commonmark+yaml_metadata_block
#+PANDOC_OPTIONS: standalone:t
#+PANDOC_OPTIONS: shift-heading-level-by:2
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;TITLE&lt;&#x2F;code&gt;, &lt;code&gt;DATE&lt;&#x2F;code&gt;, and &lt;code&gt;PANDOC_METADATA&lt;&#x2F;code&gt; fields are added to the
exported markdown metadata block. To add the metadata block to the
generated markdown file we set the &lt;code&gt;yaml_metadata_block&lt;&#x2F;code&gt; pandoc
extension in &lt;code&gt;PANDOC_EXTENSIONS&lt;&#x2F;code&gt;, and the &lt;code&gt;standalone:t&lt;&#x2F;code&gt; option in
&lt;code&gt;PANDOC_OPTIONS&lt;&#x2F;code&gt;. The last line is used to start the generated headings&#x27;
levels at 3 for styling purposes.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, I use the &lt;code&gt;C-c C-e p c&lt;&#x2F;code&gt; shortcut to generate the markdown file,
which goes into the same folder, i.e.:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;example&quot; class=&quot;language-example &quot;&gt;&lt;code class=&quot;language-example&quot; data-lang=&quot;example&quot;&gt;content
└── blog
   └── 01-hello-world
      ├── index.org
      ├── index.md
      └── ... &amp;#x2F;&amp;#x2F; other files
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You can find the Org source for this post &lt;a href=&quot;https:&#x2F;&#x2F;adbjesus.com&#x2F;blog&#x2F;hello-world&#x2F;index.org&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deploying-with-nix&quot;&gt;Deploying with Nix&lt;&#x2F;h3&gt;
&lt;p&gt;I deploy this site to my &lt;a href=&quot;https:&#x2F;&#x2F;nixos.org&quot;&gt;NixOS&lt;&#x2F;a&gt; server using the
declarative NixOS configuration capabilities. For this I have a
&lt;code&gt;flake.nix&lt;&#x2F;code&gt; in the repository of this site (edit: as of 2023-08-01 the
flake no longer uses flake-utils but the idea is the same, you can check
the latest version on the repository):&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;nix&quot; class=&quot;language-nix &quot;&gt;&lt;code class=&quot;language-nix&quot; data-lang=&quot;nix&quot;&gt;{
  description = &amp;quot;My personal website&amp;quot;;

  inputs = {
    nixpkgs = {
      url = &amp;quot;github:nixos&amp;#x2F;nixpkgs&amp;#x2F;nixos-22.05&amp;quot;;
    };

    flake-utils = {
      url = &amp;quot;github:numtide&amp;#x2F;flake-utils&amp;quot;;
      inputs.nixpkgs.follows = &amp;quot;nixpkgs&amp;quot;;
    };
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs { inherit system; };
      in rec {
        packages.website =
          pkgs.stdenv.mkDerivation {
            name = &amp;quot;website&amp;quot;;
            src = self;

            buildInputs = [ pkgs.zola ];

            buildPhase = &amp;#x27;&amp;#x27;
              zola build
            &amp;#x27;&amp;#x27;;

            installPhase = &amp;#x27;&amp;#x27;
              mkdir -p $out cp -Tr public $out&amp;#x2F;public
            &amp;#x27;&amp;#x27;;
          };

        packages.default = self.packages.${system}.website;
      }
    );
}
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then I add this repository to the inputs section of the NixOS
&lt;code&gt;flake.nix&lt;&#x2F;code&gt; configuration file.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;nix&quot; class=&quot;language-nix &quot;&gt;&lt;code class=&quot;language-nix&quot; data-lang=&quot;nix&quot;&gt;inputs.website = {
  url = &amp;quot;git+https:&amp;#x2F;&amp;#x2F;git.adbjesus.com&amp;#x2F;website&amp;quot;;
  inputs.nixpkgs.follows = &amp;quot;nixpkgs&amp;quot;;
};
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and use the &lt;code&gt;nginx.virtualHosts&lt;&#x2F;code&gt; option to deploy it:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;nix&quot; class=&quot;language-nix &quot;&gt;&lt;code class=&quot;language-nix&quot; data-lang=&quot;nix&quot;&gt;services.nginx.virtualHosts = {
  &amp;quot;adbjesus.com&amp;quot; = {
    default = true;
    forceSSL = true;
    enableACME = true;
    locations.&amp;quot;&amp;#x2F;&amp;quot; = {
      root = &amp;quot;${website.packages.x86_64-linux.website}&amp;#x2F;public&amp;quot;;
    };
  };
};
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the future, I will write more about my NixOS configuration using
flakes, which I use to manage my personal computers and server.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;edits&quot;&gt;Edits&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;2023-01-08: Updated the link to the website, added note stating that I
no longer use flake-utils.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
</feed>
