1
1
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-08-16 08:00:34 +03:00

add forward compatibility for literalExample deprecation

Fixes #367
This commit is contained in:
Daiderd Jordan 2021-10-23 15:05:52 +02:00
parent 8dfeb92ec1
commit 44da835ac4
No known key found for this signature in database
GPG Key ID: D02435D05B810C96
21 changed files with 34 additions and 29 deletions

View File

@ -62,7 +62,7 @@
<emphasis>Example:</emphasis>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="attr[@name = 'example']/attrs[attr[@name = '_type' and string[@value = 'literalExample']]]">
<xsl:when test="attr[@name = 'example']/attrs[attr[@name = '_type' and string[@value = 'literalExpression']]]">
<programlisting><xsl:value-of select="attr[@name = 'example']/attrs/attr[@name = 'text']/string/@value" /></programlisting>
</xsl:when>
<xsl:otherwise>
@ -162,7 +162,7 @@
</xsl:template>
<xsl:template match="attrs[attr[@name = '_type' and string[@value = 'literalExample']]]">
<xsl:template match="attrs[attr[@name = '_type' and string[@value = 'literalExpression']]]">
<xsl:value-of select="attr[@name = 'text']/string/@value" />
</xsl:template>

View File

@ -26,7 +26,13 @@ let
};
};
eval = lib.evalModules (builtins.removeAttrs args [ "inputs" "system" ] // {
libExtended = lib.extend (self: super: {
# Added in nixpkgs #136909, adds forward compatibility until 22.03 is deprecated.
literalExpression = super.literalExpression or super.literalExample;
literalDocBook = super.literalDocBook or super.literalExample;
});
eval = libExtended.evalModules (builtins.removeAttrs args [ "inputs" "system" ] // {
modules = modules ++ [ inputsModule pkgsModule ] ++ baseModules;
args = { inherit baseModules modules; };
specialArgs = { modulesPath = builtins.toString ./modules; } // specialArgs;

View File

@ -19,7 +19,7 @@ in
environment.systemPackages = mkOption {
type = types.listOf types.package;
default = [];
example = literalExample "[ pkgs.curl pkgs.vim ]";
example = literalExpression "[ pkgs.curl pkgs.vim ]";
description = ''
The set of packages that appear in
/run/current-system/sw. These packages are

View File

@ -21,7 +21,7 @@ in
fonts.fonts = mkOption {
type = types.listOf types.path;
default = [];
example = literalExample "[ pkgs.dejavu_fonts ]";
example = literalExpression "[ pkgs.dejavu_fonts ]";
description = "List of fonts to install.";
};
};

View File

@ -48,7 +48,7 @@ in
type = types.either types.package types.path;
default = pkgs.nix;
defaultText = "pkgs.nix";
example = literalExample "pkgs.nixUnstable";
example = literalExpression "pkgs.nixUnstable";
description = ''
This option specifies the package or profile that contains the version of Nix to use throughout the system.
To keep the version of nix originally installed the default profile can be used.
@ -366,7 +366,7 @@ in
flake = mkOption {
type = types.unspecified;
default = null;
example = literalExample "nixpkgs";
example = literalExpression "nixpkgs";
description = ''
The flake input to which <option>from></option> is to be rewritten.
'';

View File

@ -50,7 +50,7 @@ in
options = {
nixpkgs.config = mkOption {
default = {};
example = literalExample
example = literalExpression
''
{ firefox.enableGeckoMediaPlayer = true;
packageOverrides = pkgs: {
@ -75,7 +75,7 @@ in
nixpkgs.overlays = mkOption {
type = types.listOf overlayType;
default = [];
example = literalExample ''
example = literalExpression ''
[ (self: super: {
openssh = super.openssh.override {
hpnSupport = true;

View File

@ -58,7 +58,7 @@ in
description = ''
The set of system-wide known SSH hosts.
'';
example = literalExample ''
example = literalExpression ''
[
{
hostNames = [ "myhost" "myhost.mydomain.com" "10.10.1.4" ];

View File

@ -31,7 +31,7 @@ in
programs.vim.extraKnownPlugins = mkOption {
type = types.attrsOf types.package;
default = {};
example = literalExample
example = literalExpression
''
{
vim-jsx = pkgs.vimUtils.buildVimPluginFrom2Nix {

View File

@ -24,7 +24,7 @@ in
security.pki.certificateFiles = mkOption {
type = types.listOf types.path;
default = [];
example = literalExample "[ \"\${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt\" ]";
example = literalExpression "[ \"\${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt\" ]";
description = ''
A list of files containing trusted root certificates in PEM
format. These are concatenated to form
@ -37,7 +37,7 @@ in
security.pki.certificates = mkOption {
type = types.listOf types.str;
default = [];
example = literalExample ''
example = literalExpression ''
[ '''
NixOS.org
=========

View File

@ -17,7 +17,7 @@ in
services.chunkwm.package = mkOption {
type = types.package;
example = literalExample "pkgs.chunkwm";
example = literalExpression "pkgs.chunkwm";
description = "This option specifies the chunkwm package to use.";
};

View File

@ -38,7 +38,7 @@ in
type = types.attrs;
default = {};
description = "List of domains that will be redirected by the DNSmasq.";
example = literalExample ''
example = literalExpression ''
{ localhost = "127.0.0.1"; }
'';
};

View File

@ -19,14 +19,13 @@ in {
path = mkOption {
type = types.listOf types.path;
default = [];
example = literalExample "[ pkgs.pass pkgs.bash pkgs.notmuch ]";
example = literalExpression "[ pkgs.pass pkgs.bash pkgs.notmuch ]";
description = "List of derivations to put in Offlineimap's path.";
};
startInterval = mkOption {
type = types.nullOr types.int;
default = 300;
example = literalExample "300";
description = "Optional key to start offlineimap services each N seconds";
};

View File

@ -17,7 +17,7 @@ in
services.ofborg.package = mkOption {
type = types.package;
example = literalExample "pkgs.ofborg";
example = literalExpression "pkgs.ofborg";
description = ''
This option specifies the ofborg package to use. eg.

View File

@ -81,7 +81,7 @@ in
extraPlugins = mkOption {
type = types.listOf types.path;
default = [];
example = literalExample "[ (pkgs.postgis.override { postgresql = pkgs.postgresql94; }) ]";
example = literalExpression "[ (pkgs.postgis.override { postgresql = pkgs.postgresql94; }) ]";
description = ''
When this list contains elements a new store path is created.
PostgreSQL and the elements are symlinked into it. Then pg_config,

View File

@ -22,7 +22,7 @@ in
services.privoxy.package = mkOption {
type = types.package;
default = pkgs.privoxy;
example = literalExample "pkgs.privoxy";
example = literalExpression "pkgs.privoxy";
description = "This option specifies the privoxy package to use.";
};

View File

@ -33,7 +33,7 @@ in
services.spacebar.config = mkOption {
type = attrs;
default = {};
example = literalExample ''
example = literalExpression ''
{
clock_format = "%R";
background_color = "0xff202020";
@ -48,7 +48,7 @@ in
services.spacebar.extraConfig = mkOption {
type = str;
default = "";
example = literalExample ''
example = literalExpression ''
echo "spacebar config loaded..."
'';
description = ''

View File

@ -42,7 +42,7 @@ in
services.yabai.config = mkOption {
type = attrs;
default = {};
example = literalExample ''
example = literalExpression ''
{
focus_follows_mouse = "autoraise";
mouse_follows_focus = "off";
@ -63,7 +63,7 @@ in
services.yabai.extraConfig = mkOption {
type = str;
default = "";
example = literalExample ''
example = literalExpression ''
yabai -m rule --add app='System Preferences' manage=off
'';
description = "Extra arbitrary configuration to append to the configuration file";

View File

@ -12,7 +12,7 @@ in
system.patches = mkOption {
type = types.listOf types.path;
default = [];
example = literalExample ''
example = literalExpression ''
[
(pkgs.writeText "bashrc.patch" ''''
--- a/etc/bashrc

View File

@ -11,7 +11,7 @@ in
environment.shells = mkOption {
type = types.listOf (types.either types.shellPackage types.path);
default = [];
example = literalExample "[ pkgs.bashInteractive pkgs.zsh ]";
example = literalExpression "[ pkgs.bashInteractive pkgs.zsh ]";
description = ''
A list of permissible login shells for user accounts.
No need to mention <literal>/bin/sh</literal>

View File

@ -60,14 +60,14 @@ with lib;
shell = mkOption {
type = types.either types.shellPackage types.path;
default = "/sbin/nologin";
example = literalExample "pkgs.bashInteractive";
example = literalExpression "pkgs.bashInteractive";
description = "The user's shell.";
};
packages = mkOption {
type = types.listOf types.package;
default = [];
example = literalExample "[ pkgs.firefox pkgs.thunderbird ]";
example = literalExpression "[ pkgs.firefox pkgs.thunderbird ]";
description = ''
The set of packages that should be made availabe to the user.
This is in contrast to <option>environment.systemPackages</option>,

View File

@ -62,7 +62,7 @@ if [ "$(evalOpt "_type")" = '"option"' ]; then
evalOpt "default" || evalOptText "defaultText" || echo "no default"
echo
echo "Example:"
if [ "$(evalOpt "example._type")" = '"literalExample"' ]; then
if [ "$(evalOpt "example._type")" = '"literalExpression"' ]; then
evalOptText "example.text" || echo "no example"
else
evalOpt "example" || echo "no example"