patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob e641642de07c1549e69fc12e91c4e80e2f82d035 1791 bytes (raw)
name: lib/config.nix 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 
# SPDX-FileCopyrightText: 2023 Alyssa Ross <hi@alyssa.is>
# SPDX-License-Identifier: MIT

let
  customConfigPath = builtins.tryEval <spectrum-config>;
in

{ config ?
  if customConfigPath.success then import customConfigPath.value
  else if builtins.pathExists ../config.nix then import ../config.nix
  else {}
}:

let
  default = import ../lib/config.default.nix;

  callConfig = config: if builtins.typeOf config == "lambda" then config {
    inherit default;
  } else config;
  finalConfig = default // callConfig config;
  # Use builtins.fromJSON because it supports \uXXXX escapes.
  # This is the same regex used by check-url.awk in the update VM.
  # The update code is careful to escape any metacharacters, but some
  # simply cannot be made to work.  Concatenating the URL with /SHA256SUMS
  # must append to the path portion of the URL, and the URL must be one
  # that libcurl will accept.
  urlRegex = builtins.fromJSON "\"^[^\\u0001- #?\\u007F]+$\"";
in

# Version is used in many files, so validate it here.
# See https://uapi-group.org/specifications/specs/version_format_specification
# for allowed version strings.
if builtins.match "[[:alnum:]_.~^-]+" finalConfig.version == null then
   builtins.abort ''
     Version ${builtins.toJSON finalConfig.version} has forbidden characters.
     Only ASCII alphanumerics, ".", "_", "~", "^", "+", and "-" are allowed.
     See <https://uapi-group.org/specifications/specs/version_format_specification>.
     ''
else
if builtins.match urlRegex finalConfig.updateUrl == null then
   builtins.abort ''
    Update URL ${builtins.toJSON finalConfig.updateUrl} has forbidden characters.
    Query strings, and fragment specifiers are not supported.
    ASCII control characters and whitespace must be %-encoded.
    ''
else
finalConfig

debug log:

solving e641642de07c1549e69fc12e91c4e80e2f82d035 ...
found e641642de07c1549e69fc12e91c4e80e2f82d035 in https://inbox.spectrum-os.org/spectrum-devel/20251129-updates-v6-8-9edb87a2e509@gmail.com/ ||
	https://inbox.spectrum-os.org/spectrum-devel/20251126-updates-v4-13-40c438d2dcaf@gmail.com/ ||
	https://inbox.spectrum-os.org/spectrum-devel/20251126-updates-v5-13-fd746748febd@gmail.com/
found e437cdbe9aa22dd0f9c8d7052ac331c8fccf6ce6 in https://spectrum-os.org/git/spectrum
preparing index
index prepared:
100644 e437cdbe9aa22dd0f9c8d7052ac331c8fccf6ce6	lib/config.nix

applying [1/1] https://inbox.spectrum-os.org/spectrum-devel/20251129-updates-v6-8-9edb87a2e509@gmail.com/
diff --git a/lib/config.nix b/lib/config.nix
index e437cdbe9aa22dd0f9c8d7052ac331c8fccf6ce6..e641642de07c1549e69fc12e91c4e80e2f82d035 100644

Checking patch lib/config.nix...
Applied patch lib/config.nix cleanly.

skipping https://inbox.spectrum-os.org/spectrum-devel/20251126-updates-v4-13-40c438d2dcaf@gmail.com/ for e641642de07c1549e69fc12e91c4e80e2f82d035
skipping https://inbox.spectrum-os.org/spectrum-devel/20251126-updates-v5-13-fd746748febd@gmail.com/ for e641642de07c1549e69fc12e91c4e80e2f82d035
index at:
100644 e641642de07c1549e69fc12e91c4e80e2f82d035	lib/config.nix

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).