Skip to content

Commit

Permalink
feat(nginx): configFilePath option to symlink generated config (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
szucsitg authored and adam-szucsmatyas committed Apr 26, 2024
1 parent dbb93b3 commit 798ddf2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion nix/nginx.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ in
description = "The nginx configuration file.";
};

configFilePath = lib.mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Provides optional setting to copy the config file to the user provided path.
Useful for scenarios where you want to relatively import files in the config.
'';
};

outputs.settings = lib.mkOption {
type = lib.types.deferredModule;
internal = true;
Expand All @@ -100,7 +109,8 @@ in
if [[ ! -d "${config.dataDir}" ]]; then
mkdir -p "${config.dataDir}"
fi
nginx -p "$(pwd)" -c ${config.configFile} -e /dev/stderr
${if isNull config.configFilePath then "" else "ln -sfn ${config.configFile} ${config.configFilePath}"}
nginx -p "$(pwd)" -c "${if isNull config.configFilePath then config.configFile else config.configFilePath}" -e /dev/stderr
'';
};
in
Expand Down

0 comments on commit 798ddf2

Please sign in to comment.