diff --git a/doc/manual/options-to-docbook.xsl b/doc/manual/options-to-docbook.xsl index a65aa62..74fb270 100644 --- a/doc/manual/options-to-docbook.xsl +++ b/doc/manual/options-to-docbook.xsl @@ -62,7 +62,7 @@ Example: - + @@ -162,7 +162,7 @@ - + diff --git a/eval-config.nix b/eval-config.nix index e0ce18b..99135fa 100644 --- a/eval-config.nix +++ b/eval-config.nix @@ -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; diff --git a/modules/environment/default.nix b/modules/environment/default.nix index eed1604..601b0ca 100644 --- a/modules/environment/default.nix +++ b/modules/environment/default.nix @@ -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 diff --git a/modules/fonts/default.nix b/modules/fonts/default.nix index 195edd6..2c7341a 100644 --- a/modules/fonts/default.nix +++ b/modules/fonts/default.nix @@ -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."; }; }; diff --git a/modules/nix/default.nix b/modules/nix/default.nix index 09b4e63..334243e 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -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 is to be rewritten. ''; diff --git a/modules/nix/nixpkgs.nix b/modules/nix/nixpkgs.nix index dc95f91..7746819 100644 --- a/modules/nix/nixpkgs.nix +++ b/modules/nix/nixpkgs.nix @@ -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; diff --git a/modules/programs/ssh/default.nix b/modules/programs/ssh/default.nix index af2d76b..f93890f 100644 --- a/modules/programs/ssh/default.nix +++ b/modules/programs/ssh/default.nix @@ -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" ]; diff --git a/modules/programs/vim.nix b/modules/programs/vim.nix index bceae54..345532e 100644 --- a/modules/programs/vim.nix +++ b/modules/programs/vim.nix @@ -31,7 +31,7 @@ in programs.vim.extraKnownPlugins = mkOption { type = types.attrsOf types.package; default = {}; - example = literalExample + example = literalExpression '' { vim-jsx = pkgs.vimUtils.buildVimPluginFrom2Nix { diff --git a/modules/security/pki/default.nix b/modules/security/pki/default.nix index b6e99d2..4f3cf30 100644 --- a/modules/security/pki/default.nix +++ b/modules/security/pki/default.nix @@ -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 ========= diff --git a/modules/services/chunkwm.nix b/modules/services/chunkwm.nix index 21fa080..3a59270 100644 --- a/modules/services/chunkwm.nix +++ b/modules/services/chunkwm.nix @@ -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."; }; diff --git a/modules/services/dnsmasq.nix b/modules/services/dnsmasq.nix index 99486f1..7ea674f 100644 --- a/modules/services/dnsmasq.nix +++ b/modules/services/dnsmasq.nix @@ -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"; } ''; }; diff --git a/modules/services/mail/offlineimap.nix b/modules/services/mail/offlineimap.nix index d7228c9..9d0d4dc 100644 --- a/modules/services/mail/offlineimap.nix +++ b/modules/services/mail/offlineimap.nix @@ -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"; }; diff --git a/modules/services/ofborg/default.nix b/modules/services/ofborg/default.nix index 172ea77..5bc0f9d 100644 --- a/modules/services/ofborg/default.nix +++ b/modules/services/ofborg/default.nix @@ -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. diff --git a/modules/services/postgresql/default.nix b/modules/services/postgresql/default.nix index a17ef3b..db5c025 100644 --- a/modules/services/postgresql/default.nix +++ b/modules/services/postgresql/default.nix @@ -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, diff --git a/modules/services/privoxy/default.nix b/modules/services/privoxy/default.nix index 5cb16c8..b314723 100644 --- a/modules/services/privoxy/default.nix +++ b/modules/services/privoxy/default.nix @@ -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."; }; diff --git a/modules/services/spacebar/default.nix b/modules/services/spacebar/default.nix index 51ea998..a56dac5 100644 --- a/modules/services/spacebar/default.nix +++ b/modules/services/spacebar/default.nix @@ -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 = '' diff --git a/modules/services/yabai/default.nix b/modules/services/yabai/default.nix index 8ac563f..b4961d4 100644 --- a/modules/services/yabai/default.nix +++ b/modules/services/yabai/default.nix @@ -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"; diff --git a/modules/system/patches.nix b/modules/system/patches.nix index 0ef3e73..e434880 100644 --- a/modules/system/patches.nix +++ b/modules/system/patches.nix @@ -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 diff --git a/modules/system/shells.nix b/modules/system/shells.nix index 3009927..ac9d619 100644 --- a/modules/system/shells.nix +++ b/modules/system/shells.nix @@ -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 /bin/sh diff --git a/modules/users/user.nix b/modules/users/user.nix index 44fb107..4060a65 100644 --- a/modules/users/user.nix +++ b/modules/users/user.nix @@ -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 , diff --git a/pkgs/nix-tools/darwin-option.sh b/pkgs/nix-tools/darwin-option.sh index 57a73e5..d6d466b 100755 --- a/pkgs/nix-tools/darwin-option.sh +++ b/pkgs/nix-tools/darwin-option.sh @@ -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"