2009-09-28 19:26:13 +01:00
|
|
|
{pkgs, options, config, ...}:
|
|
|
|
|
|
|
|
|
|
|
|
let
|
|
|
|
to = throw "This is just a dummy keyword";
|
2009-09-29 16:21:36 +01:00
|
|
|
|
|
|
|
alias = from: to: {
|
|
|
|
name = "Alias";
|
|
|
|
msg.use = x: x;
|
|
|
|
msg.define = x: x;
|
|
|
|
};
|
|
|
|
|
|
|
|
obsolete = from: to: {
|
|
|
|
name = "Obsolete name";
|
|
|
|
msg.use = x:
|
2010-05-07 16:14:50 +01:00
|
|
|
builtins.trace "Obsolete option `${from}' is used instead of `${to}'." x;
|
2009-09-29 16:21:36 +01:00
|
|
|
msg.define = x:
|
2010-05-07 16:14:50 +01:00
|
|
|
builtins.trace "Obsolete option `${from}' is defined instead of `${to}'." x;
|
2009-09-29 16:21:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
deprecated = from: to: {
|
|
|
|
name = "Deprecated name";
|
|
|
|
msg.use = x:
|
2010-05-07 16:14:50 +01:00
|
|
|
abort "Deprecated option `${from}' is used instead of `${to}'.";
|
2009-09-29 16:21:36 +01:00
|
|
|
msg.define = x:
|
2010-05-07 16:14:50 +01:00
|
|
|
abort "Deprecated option `${from}' is defined instead of `${to}'.";
|
2009-09-29 16:21:36 +01:00
|
|
|
};
|
|
|
|
|
2009-09-28 19:26:13 +01:00
|
|
|
|
|
|
|
zipModules = list: with pkgs.lib;
|
|
|
|
zip (n: v:
|
|
|
|
if tail v != [] then zipModules v else head v
|
|
|
|
) list;
|
|
|
|
|
2009-09-29 16:21:36 +01:00
|
|
|
rename = statusTemplate: from: keyword: to: with pkgs.lib;
|
2009-09-28 19:26:13 +01:00
|
|
|
let
|
2009-09-29 16:21:36 +01:00
|
|
|
status = statusTemplate from to;
|
2009-09-28 19:26:13 +01:00
|
|
|
setTo = setAttrByPath (splitString "." to);
|
|
|
|
setFrom = setAttrByPath (splitString "." from);
|
2009-09-29 14:44:07 +01:00
|
|
|
toOf = attrByPath (splitString "." to)
|
2010-05-07 16:14:50 +01:00
|
|
|
(abort "Renaming error: option `${to}' does not exists.");
|
2009-09-29 14:44:07 +01:00
|
|
|
fromOf = attrByPath (splitString "." from)
|
2010-05-07 16:14:50 +01:00
|
|
|
(abort "Internal error: option `${from}' should be declared.");
|
2009-09-28 19:26:13 +01:00
|
|
|
in
|
|
|
|
[{
|
|
|
|
options = setFrom (mkOption {
|
2009-09-29 16:21:36 +01:00
|
|
|
description = "${status.name} of <option>${to}</option>.";
|
|
|
|
apply = x: status.msg.use (toOf config);
|
2009-09-28 19:26:13 +01:00
|
|
|
});
|
|
|
|
}] ++
|
|
|
|
[{
|
|
|
|
options = setTo (mkOption {
|
2009-09-29 16:21:36 +01:00
|
|
|
extraConfigs =
|
|
|
|
let externalDefs = (fromOf options).definitions; in
|
|
|
|
if externalDefs == [] then []
|
|
|
|
else map (def: def.value) (status.msg.define externalDefs);
|
2009-09-28 19:26:13 +01:00
|
|
|
});
|
|
|
|
}];
|
|
|
|
|
|
|
|
in zipModules ([]
|
|
|
|
|
|
|
|
# usage example:
|
|
|
|
# ++ rename alias "services.xserver.slim.theme" to "services.xserver.displayManager.slim.theme"
|
2009-09-28 19:26:18 +01:00
|
|
|
++ rename obsolete "environment.extraPackages" to "environment.systemPackages"
|
2009-09-28 19:26:13 +01:00
|
|
|
|
2009-09-29 10:50:38 +01: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 16:03:08 +01:00
|
|
|
++ rename obsolete "boot.grubSplashImage" to "boot.loader.grub.splashImage"
|
2009-09-28 19:26:13 +01:00
|
|
|
|
2009-12-15 14:05:01 +00:00
|
|
|
++ rename obsolete "boot.initrd.extraKernelModules" to "boot.initrd.kernelModules"
|
|
|
|
|
2010-03-11 17:02:49 +00:00
|
|
|
# OpenSSH
|
|
|
|
++ rename obsolete "services.sshd.ports" to "services.openssh.ports"
|
|
|
|
++ rename obsolete "services.sshd.enable" to "services.openssh.enable"
|
|
|
|
++ rename obsolete "services.sshd.allowSFTP" to "services.openssh.allowSFTP"
|
|
|
|
++ rename obsolete "services.sshd.forwardX11" to "services.openssh.forwardX11"
|
|
|
|
++ rename obsolete "services.sshd.gatewayPorts" to "services.openssh.gatewayPorts"
|
|
|
|
++ rename obsolete "services.sshd.permitRootLogin" to "services.openssh.permitRootLogin"
|
2009-11-22 00:40:53 +00:00
|
|
|
++ rename obsolete "services.xserver.startSSHAgent" to "services.xserver.startOpenSSHAgent"
|
|
|
|
|
2009-10-12 18:09:38 +01:00
|
|
|
# KDE
|
2009-10-06 20:25:25 +01:00
|
|
|
++ rename deprecated "kde.extraPackages" to "environment.kdePackages"
|
|
|
|
|
|
|
|
|
2009-09-28 19:26:13 +01:00
|
|
|
) # do not add renaming after this.
|