1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00: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> <emphasis>Example:</emphasis>
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
<xsl:choose> <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> <programlisting><xsl:value-of select="attr[@name = 'example']/attrs/attr[@name = 'text']/string/@value" /></programlisting>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
@ -162,7 +162,7 @@
</xsl:template> </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:value-of select="attr[@name = 'text']/string/@value" />
</xsl:template> </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; modules = modules ++ [ inputsModule pkgsModule ] ++ baseModules;
args = { inherit baseModules modules; }; args = { inherit baseModules modules; };
specialArgs = { modulesPath = builtins.toString ./modules; } // specialArgs; specialArgs = { modulesPath = builtins.toString ./modules; } // specialArgs;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -19,14 +19,13 @@ in {
path = mkOption { path = mkOption {
type = types.listOf types.path; type = types.listOf types.path;
default = []; 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."; description = "List of derivations to put in Offlineimap's path.";
}; };
startInterval = mkOption { startInterval = mkOption {
type = types.nullOr types.int; type = types.nullOr types.int;
default = 300; default = 300;
example = literalExample "300";
description = "Optional key to start offlineimap services each N seconds"; description = "Optional key to start offlineimap services each N seconds";
}; };

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -60,14 +60,14 @@ with lib;
shell = mkOption { shell = mkOption {
type = types.either types.shellPackage types.path; type = types.either types.shellPackage types.path;
default = "/sbin/nologin"; default = "/sbin/nologin";
example = literalExample "pkgs.bashInteractive"; example = literalExpression "pkgs.bashInteractive";
description = "The user's shell."; description = "The user's shell.";
}; };
packages = mkOption { packages = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = []; default = [];
example = literalExample "[ pkgs.firefox pkgs.thunderbird ]"; example = literalExpression "[ pkgs.firefox pkgs.thunderbird ]";
description = '' description = ''
The set of packages that should be made availabe to the user. The set of packages that should be made availabe to the user.
This is in contrast to <option>environment.systemPackages</option>, 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" evalOpt "default" || evalOptText "defaultText" || echo "no default"
echo echo
echo "Example:" echo "Example:"
if [ "$(evalOpt "example._type")" = '"literalExample"' ]; then if [ "$(evalOpt "example._type")" = '"literalExpression"' ]; then
evalOptText "example.text" || echo "no example" evalOptText "example.text" || echo "no example"
else else
evalOpt "example" || echo "no example" evalOpt "example" || echo "no example"