diff options
author | William A. Kennington III <william@wkennington.com> | 2015-10-15 10:22:28 -0700 |
---|---|---|
committer | William A. Kennington III <william@wkennington.com> | 2015-10-15 10:22:28 -0700 |
commit | 8a44a36ca496d2c61904b22f8ba6a77ec5aa0b36 (patch) | |
tree | 90013bf1e284372e7de0ad6b3715dc5a0ea926d1 /lib | |
parent | 1283e3da5d0bc4657677d40fa3cb117b66489ee5 (diff) | |
parent | 62e676b9598d2638e846761160082f6fec392ffe (diff) | |
download | nixlib-8a44a36ca496d2c61904b22f8ba6a77ec5aa0b36.tar nixlib-8a44a36ca496d2c61904b22f8ba6a77ec5aa0b36.tar.gz nixlib-8a44a36ca496d2c61904b22f8ba6a77ec5aa0b36.tar.bz2 nixlib-8a44a36ca496d2c61904b22f8ba6a77ec5aa0b36.tar.lz nixlib-8a44a36ca496d2c61904b22f8ba6a77ec5aa0b36.tar.xz nixlib-8a44a36ca496d2c61904b22f8ba6a77ec5aa0b36.tar.zst nixlib-8a44a36ca496d2c61904b22f8ba6a77ec5aa0b36.zip |
Merge branch 'master.upstream' into staging.upstream
Diffstat (limited to 'lib')
-rw-r--r-- | lib/maintainers.nix | 6 | ||||
-rw-r--r-- | lib/modules.nix | 65 |
2 files changed, 71 insertions, 0 deletions
diff --git a/lib/maintainers.nix b/lib/maintainers.nix index 121fca951642..ecc18ec102dc 100644 --- a/lib/maintainers.nix +++ b/lib/maintainers.nix @@ -81,6 +81,7 @@ dezgeg = "Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>"; dfoxfranke = "Daniel Fox Franke <dfoxfranke@gmail.com>"; dmalikov = "Dmitry Malikov <malikov.d.y@gmail.com>"; + dochang = "Desmond O. Chang <dochang@gmail.com>"; doublec = "Chris Double <chris.double@double.co.nz>"; ebzzry = "Rommel Martinez <ebzzry@gmail.com>"; ederoyd46 = "Matthew Brown <matt@ederoyd.co.uk>"; @@ -90,6 +91,7 @@ eikek = "Eike Kettner <eike.kettner@posteo.de>"; ellis = "Ellis Whitehead <nixos@ellisw.net>"; emery = "Emery Hemingway <emery@vfemail.net>"; + enolan = "Echo Nolan <echo@echonolan.net>"; epitrochoid = "Mabry Cervin <mpcervin@uncg.edu>"; ericbmerritt = "Eric Merritt <eric@afiniate.com>"; erikryb = "Erik Rybakken <erik.rybakken@math.ntnu.no>"; @@ -100,6 +102,7 @@ fluffynukeit = "Daniel Austin <dan@fluffynukeit.com>"; forkk = "Andrew Okin <forkk@forkk.net>"; fpletz = "Franz Pletz <fpletz@fnordicwalking.de>"; + fps = "Florian Paul Schmidt <mista.tapas@gmx.net>"; fridh = "Frederik Rietdijk <fridh@fridh.nl>"; fro_ozen = "fro_ozen <fro_ozen@gmx.de>"; ftrvxmtrx = "Siarhei Zirukin <ftrvxmtrx@gmail.com>"; @@ -129,6 +132,7 @@ iyzsong = "Song Wenwu <iyzsong@gmail.com>"; j-keck = "Jürgen Keck <jhyphenkeck@gmail.com>"; jagajaga = "Arseniy Seroka <ars.seroka@gmail.com>"; + javaguirre = "Javier Aguirre <contacto@javaguirre.net>"; jb55 = "William Casarin <bill@casarin.me>"; jcumming = "Jack Cummings <jack@mudshark.org>"; jefdaj = "Jeffrey David Johnson <jefdaj@gmail.com>"; @@ -164,6 +168,7 @@ lowfatcomputing = "Andreas Wagner <andreas.wagner@lowfatcomputing.org>"; lsix = "Lancelot SIX <lsix@lancelotsix.com>"; ludo = "Ludovic Courtès <ludo@gnu.org>"; + lukego = "Luke Gorrie <luke@snabb.co>"; madjar = "Georges Dubus <georges.dubus@compiletoi.net>"; magnetophon = "Bart Brouns <bart@magnetophon.nl>"; mahe = "Matthias Herrmann <matthias.mh.herrmann@gmail.com>"; @@ -190,6 +195,7 @@ muflax = "Stefan Dorn <mail@muflax.com>"; nathan-gs = "Nathan Bijnens <nathan@nathan.gs>"; nckx = "Tobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>"; + nico202 = "Nicolò Balzarotti <anothersms@gmail.com>"; notthemessiah = "Brian Cohen <brian.cohen.88@gmail.com>"; np = "Nicolas Pouillard <np.nix@nicolaspouillard.fr>"; nslqqq = "Nikita Mikhailov <nslqqq@gmail.com>"; diff --git a/lib/modules.nix b/lib/modules.nix index 3e4d0547ecc5..12ec7004d1ee 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -469,6 +469,7 @@ rec { mkBefore = mkOrder 500; mkAfter = mkOrder 1500; + # Convenient property used to transfer all definitions and their # properties from one option to another. This property is useful for # renaming options, and also for including properties from another module @@ -498,4 +499,68 @@ rec { /* Compatibility. */ fixMergeModules = modules: args: evalModules { inherit modules args; check = false; }; + + /* Return a module that causes a warning to be shown if the + specified option is defined. For example, + + mkRemovedOptionModule [ "boot" "loader" "grub" "bootDevice" ] + + causes a warning if the user defines boot.loader.grub.bootDevice. + */ + mkRemovedOptionModule = optionName: + { options, ... }: + { options = setAttrByPath optionName (mkOption { + visible = false; + }); + config.warnings = + let opt = getAttrFromPath optionName options; in + optional opt.isDefined + "The option definition `${showOption optionName}' in ${showFiles opt.files} no longer has any effect; please remove it."; + }; + + /* Return a module that causes a warning to be shown if the + specified "from" option is defined; the defined value is however + forwarded to the "to" option. This can be used to rename options + while providing backward compatibility. For example, + + mkRenamedOptionModule [ "boot" "copyKernels" ] [ "boot" "loader" "grub" "copyKernels" ] + + forwards any definitions of boot.copyKernels to + boot.loader.grub.copyKernels while printing a warning. + */ + mkRenamedOptionModule = from: to: doRename { + inherit from to; + visible = false; + warn = true; + use = builtins.trace "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'."; + }; + + /* Like ‘mkRenamedOptionModule’, but doesn't show a warning. */ + mkAliasOptionModule = from: to: doRename { + inherit from to; + visible = true; + warn = false; + use = id; + }; + + doRename = { from, to, visible, warn, use }: + let + toOf = attrByPath to + (abort "Renaming error: option `${showOption to}' does not exists."); + in + { config, options, ... }: + { options = setAttrByPath from (mkOption { + description = "Alias of <option>${showOption to}</option>."; + apply = x: use (toOf config); + }); + config = { + /* + warnings = + let opt = getAttrFromPath from options; in + optional (warn && opt.isDefined) + "The option `${showOption from}' defined in ${showFiles opt.files} has been renamed to `${showOption to}'."; + */ + } // setAttrByPath to (mkAliasDefinitions (getAttrFromPath from options)); + }; + } |