Hugo
Hugo is a static site generator written in Go. It builds websites from content files and templates, supporting features such as Markdown content, themes, and flexible deployment options. Hugo is available in the NixOS ecosystem and can be used for a variety of web publishing tasks.[1]
Installation
Shell
To temporarily use Hugo in a shell environment, you can run:
nix-shell -p hugo
This will provide a shell with Hugo available without adding it to your system configuration.
System setup
To install Hugo, add it to either the system-wide environment.systemPackages
in /etc/nixos/configuration.nix
or to the user-specific home.packages
in ~/.config/nixpkgs/home.nix
.[2]
# System-wide installation (in /etc/nixos/configuration.nix)
environment.systemPackages = with pkgs; [
hugo
git # Useful for managing Hugo themes and site repositories
];
# User-specific installation (in ~/.config/nixpkgs/home.nix)
home.packages = with pkgs; [
hugo
git
];
Then, rebuild your system or apply your Home Manager configuration:
# For system-wide installation
sudo nixos-rebuild switch
# For Home Manager
home-manager switch
Configuration
Basic
Basic Hugo configuration involves creating a new site and choosing themes. Use the following command to create a new Hugo site:
hugo new site my-site
Navigate to the site directory and add a theme as a git submodule or download it directly. For detailed steps, refer to the official Hugo documentation.