nixpkgs-suyu/nixos/modules/rename.nix

153 lines
6.3 KiB
Nix
Raw Normal View History

{ config, lib, options, ... }:
2013-10-23 17:50:55 +02:00
with lib;
let
alias = from: to: rename {
inherit from to;
name = "Alias";
use = id;
define = id;
2013-10-23 18:58:05 +02:00
visible = true;
};
2014-02-04 16:32:50 +01:00
# warn option was renamed
obsolete = from: to: rename {
inherit from to;
name = "Obsolete name";
2014-02-04 16:32:50 +01:00
use = x: builtins.trace "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'." x;
2014-04-18 14:59:59 +02:00
define = x: builtins.trace "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'." x;
};
2014-02-04 16:32:50 +01:00
# abort if deprecated option is used
deprecated = from: to: rename {
inherit from to;
name = "Deprecated name";
2014-02-04 16:32:50 +01:00
use = x: abort "Deprecated option `${showOption from}' is used. It was renamed to `${showOption to}'.";
2014-04-18 14:59:59 +02:00
define = x: abort "Deprecated option `${showOption from}' is used. It was renamed to `${showOption to}'.";
};
2013-10-23 18:58:05 +02:00
showOption = concatStringsSep ".";
2013-10-23 17:50:55 +02:00
zipModules = list:
zipAttrsWith (n: v:
if tail v != [] then
if all (o: isAttrs o && o ? _type) v then mkMerge v
else if n == "_type" then head v
else if n == "warnings" then concatLists v
else if n == "description" || n == "apply" then
abort "Cannot rename an option to multiple options."
else zipModules v
else head v
) list;
2013-10-23 18:58:05 +02:00
rename = { from, to, name, use, define, visible ? false }:
let
setTo = setAttrByPath to;
setFrom = setAttrByPath from;
toOf = attrByPath to
2013-10-23 18:58:05 +02:00
(abort "Renaming error: option `${showOption to}' does not exists.");
fromOf = attrByPath from
2013-10-23 18:58:05 +02:00
(abort "Internal error: option `${showOption from}' should be declared.");
in
2013-10-23 17:50:55 +02:00
[ { options = setFrom (mkOption {
2013-10-23 18:58:05 +02:00
description = "${name} of <option>${showOption to}</option>.";
apply = x: use (toOf config);
2013-10-23 18:58:05 +02:00
inherit visible;
2013-10-23 17:50:55 +02:00
});
config = setTo (mkAliasAndWrapDefinitions define (fromOf options));
2013-10-23 17:50:55 +02:00
}
];
obsolete' = option: singleton
{ options = setAttrByPath option (mkOption {
default = null;
visible = false;
});
config.warnings = optional (getAttrFromPath option config != null)
2013-10-23 18:58:05 +02:00
"The option `${showOption option}' defined in your configuration no longer has any effect; please remove it.";
};
in zipModules ([]
++ obsolete [ "environment" "x11Packages" ] [ "environment" "systemPackages" ]
++ obsolete [ "environment" "enableBashCompletion" ] [ "programs" "bash" "enableCompletion" ]
2013-10-28 16:28:04 +01:00
++ obsolete [ "environment" "nix" ] [ "nix" "package" ]
Rewrite Fontconfig NixOS module Details: * The option `fonts.enableFontConfig` has (finally) been renamed `fonts.fontconfig.enable`. * Configurations are loaded in this order: first the Fontconfig-upstream configuration is loaded, then the NixOS-specific font directories are set, the system-wide default configuration is loaded, and finally the user configuration is loaded (if enabled). * The NixOS options `fonts.fontconfig.defaultFonts.monospace`, `fonts.fontconfig.defaultFonts.sansSerif` and `fonts.fontconfig.defaultFonts.serif` are added to allow setting the default system-wide font used for these generic faces. The defaults are the appropriate faces from the DejaVu collection because of their comprehensive Unicode coverage, clean rendering, and excellent legibility. * The NixOS option `fonts.fontconfig.antialias` can be used to disable antialiasing (it is enabled by default). * The options `fonts.fontconfig.subpixel.rgba` and `fonts.fontconfig.subpixel.lcdfilter` control the system-wide default settings for subpixel order and LCD filtering algorithm, respectively. * `fonts.fontconfig.hinting.enable` can be used to disable TrueType font hinting (it is enabled by default). `fonts.fontconfig.hinting.autohint` controls the FreeType autohinter. `fonts.fontconfig.hinting.style` controls the hint style; it is "full" by default. * User configurations can be disabled system-wide by setting `fonts.fontconfig.includeUserConf = false`. They are enabled by default so users can set Fontconfig options in the desktop environment of their choice.
2014-11-30 20:36:49 +01:00
++ obsolete [ "fonts" "enableFontConfig" ] [ "fonts" "fontconfig" "enable" ]
++ obsolete [ "fonts" "extraFonts" ] [ "fonts" "fonts" ]
++ obsolete [ "security" "extraSetuidPrograms" ] [ "security" "setuidPrograms" ]
++ obsolete [ "networking" "enableWLAN" ] [ "networking" "wireless" "enable" ]
++ obsolete [ "networking" "enableRT73Firmware" ] [ "networking" "enableRalinkFirmware" ]
# FIXME: Remove these eventually.
++ obsolete [ "boot" "systemd" "sockets" ] [ "systemd" "sockets" ]
++ obsolete [ "boot" "systemd" "targets" ] [ "systemd" "targets" ]
++ obsolete [ "boot" "systemd" "services" ] [ "systemd" "services" ]
# Old Grub-related options.
++ 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" ]
++ obsolete [ "boot" "initrd" "extraKernelModules" ] [ "boot" "initrd" "kernelModules" ]
2013-10-30 17:37:45 +01:00
++ obsolete [ "boot" "extraKernelParams" ] [ "boot" "kernelParams" ]
# OpenSSH
++ 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" ]
++ obsolete [ "services" "xserver" "startOpenSSHAgent" ] [ "programs" "ssh" "startAgent" ]
# VirtualBox
++ obsolete [ "services" "virtualbox" "enable" ] [ "services" "virtualboxGuest" "enable" ]
# Tarsnap
++ obsolete [ "services" "tarsnap" "config" ] [ "services" "tarsnap" "archives" ]
# proxy
++ obsolete [ "nix" "proxy" ] [ "networking" "proxy" "default" ]
# KDE
++ deprecated [ "kde" "extraPackages" ] [ "environment" "systemPackages" ]
++ obsolete [ "environment" "kdePackages" ] [ "environment" "systemPackages" ]
# Multiple efi bootloaders now
++ obsolete [ "boot" "loader" "efi" "efibootmgr" "enable" ] [ "boot" "loader" "efi" "canTouchEfiVariables" ]
# NixOS environment changes
# !!! this hardcodes bash, could we detect from config which shell is actually used?
++ obsolete [ "environment" "promptInit" ] [ "programs" "bash" "promptInit" ]
2014-03-03 13:55:50 +01:00
++ obsolete [ "services" "xserver" "driSupport" ] [ "hardware" "opengl" "driSupport" ]
++ obsolete [ "services" "xserver" "driSupport32Bit" ] [ "hardware" "opengl" "driSupport32Bit" ]
++ obsolete [ "services" "xserver" "s3tcSupport" ] [ "hardware" "opengl" "s3tcSupport" ]
++ obsolete [ "hardware" "opengl" "videoDrivers" ] [ "services" "xserver" "videoDrivers" ]
++ obsolete [ "services" "mysql55" ] [ "services" "mysql" ]
++ alias [ "environment" "checkConfigurationOptions" ] [ "_module" "check" ]
# XBMC
++ obsolete [ "services" "xserver" "windowManager" "xbmc" ] [ "services" "xserver" "desktopManager" "kodi" ]
++ obsolete [ "services" "xserver" "desktopManager" "xbmc" ] [ "services" "xserver" "desktopManager" "kodi" ]
# Options that are obsolete and have no replacement.
++ obsolete' [ "boot" "loader" "grub" "bootDevice" ]
++ obsolete' [ "boot" "initrd" "luks" "enable" ]
++ obsolete' [ "programs" "bash" "enable" ]
++ obsolete' [ "services" "samba" "defaultShare" ]
++ obsolete' [ "services" "syslog-ng" "serviceName" ]
++ obsolete' [ "services" "syslog-ng" "listenToJournal" ]
)