I’m trying to make use of a Nix flake to manage building my personal site using hugo. I have come up with the following flake.nix file:
{
description = "Flake for vendion.me development";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ self
, nixpkgs
, flake-utils
,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
packages = {
default = pkgs.stdenv.mkDerivation {
name = "vendion.me";
src = ./.;
nativeBuildInputs = with pkgs; [
git
hugo
];
#TODO: These are just needed for local development, so shouldn't really be treated as
# a build input for the package itself.
buildInputs = with pkgs; [
just
nodePackages.nodejs
nodePackages.npm
];
buildPhase = ''
hugo
'';
};
};
}
);
}
The problem is: It has a single external dependency of the base theme, which is being managed by git submodules, that is causing errors when I try to run nix build
. When I try to do a build, with and without the ?submodules=1
parameter, I get the following due to the theme not being copied over to the Nix store:
➜ nix build ‘.?submodules=1’
error: builder for ‘/nix/store/df7hwlasnjias3p9i6v581k4hnxhc0js-vendion.me.drv’ failed with exit code 1;
last 10 log lines:
> Running phase: unpackPhase
> unpacking source archive /nix/store/rdnxg0a0y415zdi1ic0h8f94qbgkrjai-g16kcxb3fsw71q9x7705048gcg9k0lxq-source
> source root is g16kcxb3fsw71q9x7705048gcg9k0lxq-source
> Running phase: patchPhase
> Running phase: updateAutotoolsGnuConfigScriptsPhase
> Running phase: configurePhase
> no configure script, doing nothing
> Running phase: buildPhase
> Total in 1 ms
> Error: failed to load modules: module “hugo-coder” not found in “/build/g16kcxb3fsw71q9x7705048gcg9k0lxq-source/themes/hugo-coder”; either add it as a Hugo Moduleor store it in “/build/g16kcxb3fsw71q9x7705048gcg9k0lxq-source/themes”.: module does not exist
For full logs, run ‘nix log /nix/store/df7hwlasnjias3p9i6v581k4hnxhc0js-vendion.me.drv’.
How would be the best way to handle this dependency to make the site be buildable with Nix?