diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/licenses.nix | 5 | ||||
-rw-r--r-- | lib/modules.nix | 4 | ||||
-rw-r--r-- | lib/systems/default.nix | 5 | ||||
-rwxr-xr-x | lib/tests/modules.sh | 7 | ||||
-rw-r--r-- | lib/tests/modules/doRename-basic.nix | 11 | ||||
-rw-r--r-- | lib/tests/modules/doRename-warnings.nix | 14 | ||||
-rw-r--r-- | lib/types.nix | 1 |
7 files changed, 42 insertions, 5 deletions
diff --git a/lib/licenses.nix b/lib/licenses.nix index ba0aba1959bc7..09f8be7d725b6 100644 --- a/lib/licenses.nix +++ b/lib/licenses.nix @@ -109,6 +109,11 @@ in mkLicense lset) ({ fullName = "Apache License 2.0"; }; + bitstreamVera = { + spdxId = "Bitstream-Vera"; + fullName = "Bitstream Vera Font License"; + }; + bola11 = { url = "https://blitiri.com.ar/p/bola/"; fullName = "Buena Onda License Agreement 1.1"; diff --git a/lib/modules.nix b/lib/modules.nix index a7fbec93a2f51..204a2cc1ac12a 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -1135,10 +1135,10 @@ rec { type = toType; }); config = mkMerge [ - { + (optionalAttrs (options ? warnings) { warnings = optional (warn && fromOpt.isDefined) "The option `${showOption from}' defined in ${showFiles fromOpt.files} has been renamed to `${showOption to}'."; - } + }) (if withPriority then mkAliasAndWrapDefsWithPriority (setAttrByPath to) fromOpt else mkAliasAndWrapDefinitions (setAttrByPath to) fromOpt) diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 233174d40831c..4af3d612f81bd 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -183,14 +183,13 @@ rec { seccompSupport = false; hostCpuTargets = [ "${final.qemuArch}-linux-user" ]; }; - wine-name = "wine${toString final.parsed.cpu.bits}"; - wine = (pkgs.winePackagesFor wine-name).minimal; + wine = (pkgs.winePackagesFor "wine${toString final.parsed.cpu.bits}").minimal; in if final.parsed.kernel.name == pkgs.stdenv.hostPlatform.parsed.kernel.name && pkgs.stdenv.hostPlatform.canExecute final then "${pkgs.runtimeShell} -c '\"$@\"' --" else if final.isWindows - then "${wine}/bin/${wine-name}" + then "${wine}/bin/wine${lib.optionalString (final.parsed.cpu.bits == 64) "64"}" else if final.isLinux && pkgs.stdenv.hostPlatform.isLinux then "${qemu-user}/bin/qemu-${final.qemuArch}" else if final.isWasi diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index c9ea674ee104a..6d2eb24db55c6 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -348,6 +348,13 @@ checkConfigOutput 'ok' config.freeformItems.foo.bar ./adhoc-freeformType-survive # because of an `extendModules` bug, issue 168767. checkConfigOutput '^1$' config.sub.specialisation.value ./extendModules-168767-imports.nix +# doRename works when `warnings` does not exist. +checkConfigOutput '^1234$' config.c.d.e ./doRename-basic.nix +# doRename adds a warning. +checkConfigOutput '^"The option `a\.b. defined in `.*/doRename-warnings\.nix. has been renamed to `c\.d\.e.\."$' \ + config.result \ + ./doRename-warnings.nix + cat <<EOF ====== module tests ====== $pass Pass diff --git a/lib/tests/modules/doRename-basic.nix b/lib/tests/modules/doRename-basic.nix new file mode 100644 index 0000000000000..9d79fa4f26a3b --- /dev/null +++ b/lib/tests/modules/doRename-basic.nix @@ -0,0 +1,11 @@ +{ lib, ... }: { + imports = [ + (lib.doRename { from = ["a" "b"]; to = ["c" "d" "e"]; warn = true; use = x: x; visible = true; }) + ]; + options = { + c.d.e = lib.mkOption {}; + }; + config = { + a.b = 1234; + }; +} diff --git a/lib/tests/modules/doRename-warnings.nix b/lib/tests/modules/doRename-warnings.nix new file mode 100644 index 0000000000000..6f0f1e87e3aa5 --- /dev/null +++ b/lib/tests/modules/doRename-warnings.nix @@ -0,0 +1,14 @@ +{ lib, config, ... }: { + imports = [ + (lib.doRename { from = ["a" "b"]; to = ["c" "d" "e"]; warn = true; use = x: x; visible = true; }) + ]; + options = { + warnings = lib.mkOption { type = lib.types.listOf lib.types.str; }; + c.d.e = lib.mkOption {}; + result = lib.mkOption {}; + }; + config = { + a.b = 1234; + result = lib.concatStringsSep "%" config.warnings; + }; +} diff --git a/lib/types.nix b/lib/types.nix index b83898744df82..270ac1748c796 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -478,6 +478,7 @@ rec { path = mkOptionType { name = "path"; + descriptionClass = "noun"; check = x: isCoercibleToString x && builtins.substring 0 1 (toString x) == "/"; merge = mergeEqualOption; }; |