2013-10-23 16:50:55 +01:00
|
|
|
{ config, pkgs, options, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2009-09-28 19:26:13 +01:00
|
|
|
|
|
|
|
let
|
2009-09-29 16:21:36 +01:00
|
|
|
|
2013-10-23 17:51:55 +01:00
|
|
|
alias = from: to: rename {
|
|
|
|
inherit from to;
|
2009-09-29 16:21:36 +01:00
|
|
|
name = "Alias";
|
2013-10-23 17:51:55 +01:00
|
|
|
use = id;
|
|
|
|
define = id;
|
2009-09-29 16:21:36 +01:00
|
|
|
};
|
|
|
|
|
2013-10-23 17:51:55 +01:00
|
|
|
obsolete = from: to: rename {
|
|
|
|
inherit from to;
|
2009-09-29 16:21:36 +01:00
|
|
|
name = "Obsolete name";
|
2013-10-23 17:51:55 +01:00
|
|
|
use = x: builtins.trace "Obsolete option ${showOption from} is used instead of ${showOption to}." x;
|
|
|
|
define = x: builtins.trace "Obsolete option ${showOption from} is defined instead of ${showOption to}." x;
|
2009-09-29 16:21:36 +01:00
|
|
|
};
|
|
|
|
|
2013-10-23 17:51:55 +01:00
|
|
|
deprecated = from: to: rename {
|
|
|
|
inherit from to;
|
2009-09-29 16:21:36 +01:00
|
|
|
name = "Deprecated name";
|
2013-10-23 17:51:55 +01:00
|
|
|
use = x: abort "Deprecated option ${showOption from} is used instead of ${showOption to}.";
|
|
|
|
define = x: abort "Deprecated option ${showOption from} is defined instead of ${showOption to}.";
|
2009-09-29 16:21:36 +01:00
|
|
|
};
|
|
|
|
|
2013-10-23 17:51:55 +01:00
|
|
|
showOption = name: "`${concatStringsSep "." name}'";
|
|
|
|
|
2013-10-23 16:50:55 +01:00
|
|
|
zipModules = list:
|
2013-08-22 07:35:36 +01:00
|
|
|
zipAttrsWith (n: v:
|
2010-10-14 19:18:38 +01:00
|
|
|
if tail v != [] then
|
2013-02-21 19:43:02 +00:00
|
|
|
if n == "_type" then (head v)
|
2013-10-23 17:22:26 +01:00
|
|
|
else if n == "extraConfigs" then concatLists v
|
|
|
|
else if n == "warnings" then concatLists v
|
2010-10-14 19:18:38 +01:00
|
|
|
else if n == "description" || n == "apply" then
|
|
|
|
abort "Cannot rename an option to multiple options."
|
|
|
|
else zipModules v
|
|
|
|
else head v
|
2009-09-28 19:26:13 +01:00
|
|
|
) list;
|
|
|
|
|
2013-10-23 17:51:55 +01:00
|
|
|
rename = { from, to, name, use, define }:
|
2009-09-28 19:26:13 +01:00
|
|
|
let
|
2013-10-23 17:51:55 +01:00
|
|
|
setTo = setAttrByPath to;
|
|
|
|
setFrom = setAttrByPath from;
|
|
|
|
toOf = attrByPath to
|
|
|
|
(abort "Renaming error: option ${showOption to} does not exists.");
|
|
|
|
fromOf = attrByPath from
|
|
|
|
(abort "Internal error: option ${showOption from} should be declared.");
|
2009-09-28 19:26:13 +01:00
|
|
|
in
|
2013-10-23 16:50:55 +01:00
|
|
|
[ { options = setFrom (mkOption {
|
2013-10-23 17:51:55 +01:00
|
|
|
apply = x: use (toOf config);
|
2013-10-23 16:50:55 +01:00
|
|
|
visible = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
{ options = setTo (mkOption {
|
|
|
|
extraConfigs =
|
|
|
|
let externalDefs = (fromOf options).definitions; in
|
|
|
|
if externalDefs == [] then []
|
2013-10-23 17:51:55 +01:00
|
|
|
else map (def: def.value) (define externalDefs);
|
2013-10-23 16:50:55 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
];
|
2009-09-28 19:26:13 +01:00
|
|
|
|
2013-10-23 17:51:55 +01:00
|
|
|
obsolete' = option: singleton
|
|
|
|
{ options = setAttrByPath option (mkOption {
|
2013-10-23 17:22:26 +01:00
|
|
|
default = null;
|
|
|
|
visible = false;
|
|
|
|
});
|
2013-10-23 17:51:55 +01:00
|
|
|
config.warnings = optional (getAttrFromPath option config != null)
|
|
|
|
"The option ${showOption option} defined in your configuration no longer has any effect; please remove it.";
|
2013-10-23 17:22:26 +01:00
|
|
|
};
|
|
|
|
|
2009-09-28 19:26:13 +01:00
|
|
|
in zipModules ([]
|
|
|
|
|
|
|
|
# usage example:
|
2013-10-23 17:51:55 +01:00
|
|
|
# ++ alias [ "services" "xserver" "slim" "theme" ] [ "services" "xserver" "displayManager" "slim" "theme" ]
|
|
|
|
++ obsolete [ "environment" "extraPackages" ] [ "environment" "systemPackages" ]
|
|
|
|
++ obsolete [ "environment" "enableBashCompletion" ] [ "programs" "bash" "enableCompletion" ]
|
2009-09-28 19:26:13 +01:00
|
|
|
|
2013-10-23 17:51:55 +01:00
|
|
|
++ obsolete [ "security" "extraSetuidPrograms" ] [ "security" "setuidPrograms" ]
|
|
|
|
++ obsolete [ "networking" "enableWLAN" ] [ "networking" "wireless" "enable" ]
|
|
|
|
++ obsolete [ "networking" "enableRT73Firmware" ] [ "networking" "enableRalinkFirmware" ]
|
2012-03-01 20:10:46 +00:00
|
|
|
|
2013-01-16 11:33:18 +00:00
|
|
|
# FIXME: Remove these eventually.
|
2013-10-23 17:51:55 +01:00
|
|
|
++ obsolete [ "boot" "systemd" "sockets" ] [ "systemd" "sockets" ]
|
|
|
|
++ obsolete [ "boot" "systemd" "targets" ] [ "systemd" "targets" ]
|
|
|
|
++ obsolete [ "boot" "systemd" "services" ] [ "systemd" "services" ]
|
2013-01-16 11:33:18 +00:00
|
|
|
|
2009-09-29 10:50:38 +01:00
|
|
|
# Old Grub-related options.
|
2013-10-23 17:51:55 +01:00
|
|
|
++ obsolete [ "boot" "copyKernels" ] [ "boot" "loader" "grub" "copyKernels" ]
|
|
|
|
++ obsolete [ "boot" "extraGrubEntries" ] [ "boot" "loader" "grub" "extraEntries" ]
|
|
|
|
++ obsolete [ "boot" "extraGrubEntriesBeforeNixos" ] [ "boot" "loader" "grub" "extraEntriesBeforeNixOS" ]
|
|
|
|
++ obsolete [ "boot" "grubDevice" ] [ "boot" "loader" "grub" "device" ]
|
|
|
|
++ obsolete [ "boot" "bootMount" ] [ "boot" "loader" "grub" "bootDevice" ]
|
|
|
|
++ obsolete [ "boot" "grubSplashImage" ] [ "boot" "loader" "grub" "splashImage" ]
|
2009-09-28 19:26:13 +01:00
|
|
|
|
2013-10-23 17:51:55 +01:00
|
|
|
++ obsolete [ "boot" "initrd" "extraKernelModules" ] [ "boot" "initrd" "kernelModules" ]
|
2009-12-15 14:05:01 +00:00
|
|
|
|
2010-03-11 17:02:49 +00:00
|
|
|
# OpenSSH
|
2013-10-23 17:51:55 +01:00
|
|
|
++ obsolete [ "services" "sshd" "ports" ] [ "services" "openssh" "ports" ]
|
|
|
|
++ alias [ "services" "sshd" "enable" ] [ "services" "openssh" "enable" ]
|
|
|
|
++ obsolete [ "services" "sshd" "allowSFTP" ] [ "services" "openssh" "allowSFTP" ]
|
|
|
|
++ obsolete [ "services" "sshd" "forwardX11" ] [ "services" "openssh" "forwardX11" ]
|
|
|
|
++ obsolete [ "services" "sshd" "gatewayPorts" ] [ "services" "openssh" "gatewayPorts" ]
|
|
|
|
++ obsolete [ "services" "sshd" "permitRootLogin" ] [ "services" "openssh" "permitRootLogin" ]
|
|
|
|
++ obsolete [ "services" "xserver" "startSSHAgent" ] [ "services" "xserver" "startOpenSSHAgent" ]
|
2009-11-22 00:40:53 +00:00
|
|
|
|
2009-10-12 18:09:38 +01:00
|
|
|
# KDE
|
2013-10-23 17:51:55 +01:00
|
|
|
++ deprecated [ "kde" "extraPackages" ] [ "environment" "kdePackages" ]
|
|
|
|
# ++ obsolete [ "environment" "kdePackages" ] [ "environment" "systemPackages" ] # !!! doesn't work!
|
2009-10-06 20:25:25 +01:00
|
|
|
|
2013-02-02 05:03:45 +00:00
|
|
|
# Multiple efi bootloaders now
|
2013-10-23 17:51:55 +01:00
|
|
|
++ obsolete [ "boot" "loader" "efi" "efibootmgr" "enable" ] [ "boot" "loader" "efi" "canTouchEfiVariables" ]
|
2013-02-02 05:03:45 +00:00
|
|
|
|
2013-09-24 14:53:47 +01:00
|
|
|
# NixOS environment changes
|
|
|
|
# !!! this hardcodes bash, could we detect from config which shell is actually used?
|
2013-10-23 17:51:55 +01:00
|
|
|
++ obsolete [ "environment" "promptInit" ] [ "programs" "bash" "promptInit" ]
|
2013-09-24 14:53:47 +01:00
|
|
|
|
2013-10-23 17:22:26 +01:00
|
|
|
# Options that are obsolete and have no replacement.
|
2013-10-23 17:51:55 +01:00
|
|
|
++ obsolete' [ "boot" "loader" "grub" "bootDevice" ]
|
|
|
|
++ obsolete' [ "boot" "initrd" "luks" "enable" ]
|
2013-10-23 17:22:26 +01:00
|
|
|
|
2013-10-23 17:51:55 +01:00
|
|
|
)
|