2009-09-28 20:26:13 +02:00
|
|
|
{pkgs, options, config, ...}:
|
|
|
|
|
|
|
|
|
|
|
|
let
|
|
|
|
to = throw "This is just a dummy keyword";
|
2009-09-29 17:21:36 +02:00
|
|
|
|
|
|
|
alias = from: to: {
|
|
|
|
name = "Alias";
|
|
|
|
msg.use = x: x;
|
|
|
|
msg.define = x: x;
|
|
|
|
};
|
|
|
|
|
|
|
|
obsolete = from: to: {
|
|
|
|
name = "Obsolete name";
|
|
|
|
msg.use = x:
|
|
|
|
builtins.trace "Option '${from}' is used instead of '${to}'." x;
|
|
|
|
msg.define = x:
|
|
|
|
builtins.trace "Option '${from}' is defined instead of '${to}'." x;
|
|
|
|
};
|
|
|
|
|
|
|
|
deprecated = from: to: {
|
|
|
|
name = "Deprecated name";
|
|
|
|
msg.use = x:
|
|
|
|
abort "Option '${from}' is used instead of '${to}'.";
|
|
|
|
msg.define = x:
|
|
|
|
abort "Option '${from}' is defined instead of '${to}'.";
|
|
|
|
};
|
|
|
|
|
2009-09-28 20:26:13 +02:00
|
|
|
|
|
|
|
zipModules = list: with pkgs.lib;
|
|
|
|
zip (n: v:
|
|
|
|
if tail v != [] then zipModules v else head v
|
|
|
|
) list;
|
|
|
|
|
2009-09-29 17:21:36 +02:00
|
|
|
rename = statusTemplate: from: keyword: to: with pkgs.lib;
|
2009-09-28 20:26:13 +02:00
|
|
|
let
|
2009-09-29 17:21:36 +02:00
|
|
|
status = statusTemplate from to;
|
2009-09-28 20:26:13 +02:00
|
|
|
setTo = setAttrByPath (splitString "." to);
|
|
|
|
setFrom = setAttrByPath (splitString "." from);
|
2009-09-29 15:44:07 +02:00
|
|
|
toOf = attrByPath (splitString "." to)
|
|
|
|
(abort "Renaming Error: option '${to}' does not exists.");
|
|
|
|
fromOf = attrByPath (splitString "." from)
|
|
|
|
(abort "Internal Error: option '${from}' should be declared.");
|
2009-09-28 20:26:13 +02:00
|
|
|
in
|
|
|
|
[{
|
|
|
|
options = setFrom (mkOption {
|
2009-09-29 17:21:36 +02:00
|
|
|
description = "${status.name} of <option>${to}</option>.";
|
|
|
|
apply = x: status.msg.use (toOf config);
|
2009-09-28 20:26:13 +02:00
|
|
|
});
|
|
|
|
}] ++
|
|
|
|
[{
|
|
|
|
options = setTo (mkOption {
|
2009-09-29 17:21:36 +02:00
|
|
|
extraConfigs =
|
|
|
|
let externalDefs = (fromOf options).definitions; in
|
|
|
|
if externalDefs == [] then []
|
|
|
|
else map (def: def.value) (status.msg.define externalDefs);
|
2009-09-28 20:26:13 +02:00
|
|
|
});
|
|
|
|
}];
|
|
|
|
|
|
|
|
in zipModules ([]
|
|
|
|
|
|
|
|
# usage example:
|
|
|
|
# ++ rename alias "services.xserver.slim.theme" to "services.xserver.displayManager.slim.theme"
|
2009-09-28 20:26:18 +02:00
|
|
|
++ rename obsolete "environment.extraPackages" to "environment.systemPackages"
|
2009-09-28 20:26:13 +02:00
|
|
|
|
2009-09-29 11:50:38 +02:00
|
|
|
# Old Grub-related options.
|
|
|
|
++ rename obsolete "boot.copyKernels" to "boot.loader.grub.copyKernels"
|
|
|
|
++ rename obsolete "boot.extraGrubEntries" to "boot.loader.grub.extraEntries"
|
|
|
|
++ rename obsolete "boot.extraGrubEntriesBeforeNixos" to "boot.loader.grub.extraEntriesBeforeNixOS"
|
|
|
|
++ rename obsolete "boot.grubDevice" to "boot.loader.grub.device"
|
|
|
|
++ rename obsolete "boot.bootMount" to "boot.loader.grub.bootDevice"
|
2009-09-29 17:03:08 +02:00
|
|
|
++ rename obsolete "boot.grubSplashImage" to "boot.loader.grub.splashImage"
|
2009-09-28 20:26:13 +02:00
|
|
|
|
2009-10-06 11:30:13 +02:00
|
|
|
++ rename obsolete "services.extraJobs" to "jobs"
|
2009-09-28 20:26:13 +02:00
|
|
|
|
|
|
|
) # do not add renaming after this.
|