Having trouble with nixOS modules

On nixOS unstable.

I’m trying to create modules for my config. I followed the wiki:
https://nixos.wiki/wiki/Module
and created a module called hello in /etc/nixos/modules/hello.nix with the code shown in the wiki article:

{ lib, pkgs, config, ... }:
with lib;
let
  cfg = config.services.hello;
in
{
  options.services.hello = {
    enable = mkEnableOption "hello service";
    greeter = mkOption {
      type = types.str;
      default = "world";
    };
  };

  config = mkIf cfg.enable {
    systemd.services.hello = {
      wantedBy = [ "multi-user.target" ];
      serviceConfig.ExecStart = "${pkgs.hello}/bin/hello -g'Hello, ${escapeShellArg cfg.greeter}!'";
    };
  };
}

I included it in my configuration.nix file with

imports =
    [
      # Include the results of the hardware scan.
      ./hardware-configuration.nix
      ../shared/configuration.nix
      ../../modules/hello.nix
    ];

  services.hello = {
    enable = true;
    greeter = "bob";
  };

However it returns the error:

error: getting status of '/nix/store/n9v3rdqlxc985ljydl3rn9i39yx76jsd-source/modules': No such file or directory

It looks like it thinks the module is a piece of software? Why is it looking for modules in a hashed folder? Didn’t I specify path with …/…/modules/hello.nix? Should it be absolute path?

Flakes will only see files that are tracked with git, you probably have ../../modules/hello.nix unstaged.

To fix:
git add ../../modules/hello.nix
and try again

Oh. In hindsight I think I knew that. Thanks.