--- tags: - nix - nixos references: - https://nixos.org/manual/nixos/unstable/#sec-writing-modules - https://nixos.org/manual/nixpkgs/stable/#module-system-lib-evalModules - https://nix.dev/tutorials/module-system/ - llk --- Extra care must be taken when writing systemd services using Exec* due to interpolation and such. `utils.escapeSystemdExecArg` and `utils.escapeSystemdExecArg` exist. ```nix { options = { name = mkOption { type = type specification; default = default value; example = example value; description = "Description for use in the NixOS manual."; }; }; } ``` **A list of submodules** ```nix { options.mod = mkOption { description = "submodule example"; type = with types; listOf (submodule { options = { foo = mkOption { type = int; }; bar = mkOption { type = str; }; }; }); }; } ``` **Testing** ```nix eval.nix let pkgs = import {}; res = pkgs.lib.evalModules { modules = [./git-repos.nix]; }; in res.config ``` `nix-instantiate --eval eval.nix`