summaryrefslogtreecommitdiffstats
path: root/nixos
diff options
context:
space:
mode:
Diffstat (limited to 'nixos')
-rw-r--r--nixos/lib/make-options-doc/generateDoc.py32
-rw-r--r--nixos/modules/services/continuous-integration/gitlab-runner.nix14
-rw-r--r--nixos/modules/services/misc/n8n.nix7
-rw-r--r--nixos/tests/n8n.nix4
4 files changed, 32 insertions, 25 deletions
diff --git a/nixos/lib/make-options-doc/generateDoc.py b/nixos/lib/make-options-doc/generateDoc.py
index 1fe4eb0253ad..07884ed657e4 100644
--- a/nixos/lib/make-options-doc/generateDoc.py
+++ b/nixos/lib/make-options-doc/generateDoc.py
@@ -21,18 +21,22 @@ parser.add_argument(
args = parser.parse_args()
-# Pretty-print certain Nix types, like literal expressions.
-def render_types(obj):
- if '_type' not in obj: return obj
+class OptionsEncoder(json.JSONEncoder):
+ def encode(self, obj):
+ # Unpack literal expressions and other Nix types.
+ # Don't escape the strings: they were escaped when initially serialized to JSON.
+ if isinstance(obj, dict):
+ _type = obj.get('_type')
+ if _type is not None:
+ if _type == 'literalExpression' or _type == 'literalDocBook':
+ return obj['text']
- _type = obj['_type']
- if _type == 'literalExpression' or _type == 'literalDocBook':
- return obj['text']
+ if _type == 'derivation':
+ return obj['name']
- if _type == 'derivation':
- return obj['name']
+ raise Exception(f'Unexpected type `{_type}` in {json.dumps(obj)}')
- raise Exception(f'Unexpected type `{_type}` in {json.dumps(obj)}')
+ return super().encode(obj)
def generate_commonmark(options):
for (name, value) in options.items():
@@ -49,14 +53,14 @@ def generate_commonmark(options):
if 'default' in value:
print('*_Default_*')
print('```')
- print(json.dumps(value['default'], ensure_ascii=False, separators=(',', ':')))
+ print(json.dumps(value['default'], cls=OptionsEncoder, ensure_ascii=False, separators=(',', ':')))
print('```')
print()
print()
if 'example' in value:
print('*_Example_*')
print('```')
- print(json.dumps(value['example'], ensure_ascii=False, separators=(',', ':')))
+ print(json.dumps(value['example'], cls=OptionsEncoder, ensure_ascii=False, separators=(',', ':')))
print('```')
print()
print()
@@ -76,7 +80,7 @@ def generate_asciidoc(options):
print('Default::')
print('+')
print('----')
- print(json.dumps(value['default'], ensure_ascii=False, separators=(',', ':')))
+ print(json.dumps(value['default'], cls=OptionsEncoder, ensure_ascii=False, separators=(',', ':')))
print('----')
print()
else:
@@ -89,7 +93,7 @@ def generate_asciidoc(options):
print('Example::')
print('+')
print('----')
- print(json.dumps(value['example'], ensure_ascii=False, separators=(',', ':')))
+ print(json.dumps(value['example'], cls=OptionsEncoder, ensure_ascii=False, separators=(',', ':')))
print('----')
print()
else:
@@ -97,7 +101,7 @@ def generate_asciidoc(options):
print()
with open(args.nix_options_path) as nix_options_json:
- options = json.load(nix_options_json, object_hook=render_types)
+ options = json.load(nix_options_json)
if args.format == 'commonmark':
generate_commonmark(options)
diff --git a/nixos/modules/services/continuous-integration/gitlab-runner.nix b/nixos/modules/services/continuous-integration/gitlab-runner.nix
index d18c4cff0405..3e6dba16e8ac 100644
--- a/nixos/modules/services/continuous-integration/gitlab-runner.nix
+++ b/nixos/modules/services/continuous-integration/gitlab-runner.nix
@@ -9,14 +9,14 @@ let
The hash is recorded in the runner's name because we can't do better yet
See https://gitlab.com/gitlab-org/gitlab-runner/-/issues/29350 for more details
*/
- genRunnerName = service: let
+ genRunnerName = name: service: let
hash = substring 0 12 (hashString "md5" (unsafeDiscardStringContext (toJSON service)));
- in if service ? description
+ in if service ? description && service.description != null
then "${hash} ${service.description}"
else "${name}_${config.networking.hostName}_${hash}";
hashedServices = mapAttrs'
- (name: service: nameValuePair (genRunnerName service) service) cfg.services;
+ (name: service: nameValuePair (genRunnerName name service) service) cfg.services;
configPath = ''"$HOME"/.gitlab-runner/config.toml'';
configureScript = pkgs.writeShellApplication {
name = "gitlab-runner-configure";
@@ -38,7 +38,7 @@ let
'' else ''
export CONFIG_FILE=${configPath}
- mkdir -p "$(dirname "${configPath}")"
+ mkdir -p "$(dirname ${configPath})"
touch ${configPath}
# update global options
@@ -534,9 +534,9 @@ in {
};
};
config = mkIf cfg.enable {
- warnings = (mapAttrsToList
+ warnings = mapAttrsToList
(n: v: "services.gitlab-runner.services.${n}.`registrationConfigFile` points to a file in Nix Store. You should use quoted absolute path to prevent this.")
- (filterAttrs (n: v: isStorePath v.registrationConfigFile) cfg.services));
+ (filterAttrs (n: v: isStorePath v.registrationConfigFile) cfg.services);
environment.systemPackages = [ cfg.package ];
systemd.services.gitlab-runner = {
@@ -570,7 +570,7 @@ in {
ExecStartPre = "!${configureScript}/bin/gitlab-runner-configure";
ExecStart = "${startScript}/bin/gitlab-runner-start";
ExecReload = "!${configureScript}/bin/gitlab-runner-configure";
- } // optionalAttrs (cfg.gracefulTermination) {
+ } // optionalAttrs cfg.gracefulTermination {
TimeoutStopSec = "${cfg.gracefulTimeout}";
KillSignal = "SIGQUIT";
KillMode = "process";
diff --git a/nixos/modules/services/misc/n8n.nix b/nixos/modules/services/misc/n8n.nix
index f59df471e1e0..cdfe9dc8482c 100644
--- a/nixos/modules/services/misc/n8n.nix
+++ b/nixos/modules/services/misc/n8n.nix
@@ -9,7 +9,6 @@ let
in
{
options.services.n8n = {
-
enable = mkEnableOption (lib.mdDoc "n8n server");
openFirewall = mkOption {
@@ -22,7 +21,7 @@ in
type = format.type;
default = {};
description = lib.mdDoc ''
- Configuration for n8n, see <https://docs.n8n.io/reference/configuration.html>
+ Configuration for n8n, see <https://docs.n8n.io/hosting/environment-variables/configuration-methods/>
for supported values.
'';
};
@@ -45,6 +44,10 @@ in
N8N_USER_FOLDER = "/var/lib/n8n";
HOME = "/var/lib/n8n";
N8N_CONFIG_FILES = "${configFile}";
+
+ # Don't phone home
+ N8N_DIAGNOSTICS_ENABLED = "false";
+ N8N_VERSION_NOTIFICATIONS_ENABLED = "false";
};
serviceConfig = {
Type = "simple";
diff --git a/nixos/tests/n8n.nix b/nixos/tests/n8n.nix
index c1753a418f67..044240fbce7f 100644
--- a/nixos/tests/n8n.nix
+++ b/nixos/tests/n8n.nix
@@ -19,7 +19,7 @@ in
testScript = ''
machine.wait_for_unit("n8n.service")
- machine.wait_for_open_port(${toString port})
- machine.succeed("curl --fail http://localhost:${toString port}/")
+ machine.wait_for_console_text("Editor is now accessible via")
+ machine.succeed("curl --fail -vvv http://localhost:${toString port}/")
'';
})