diff options
53 files changed, 143 insertions, 143 deletions
diff --git a/doc/build-helpers/fetchers.chapter.md b/doc/build-helpers/fetchers.chapter.md index b326f189d50e..e8521861208f 100644 --- a/doc/build-helpers/fetchers.chapter.md +++ b/doc/build-helpers/fetchers.chapter.md @@ -243,7 +243,7 @@ This is a useful last-resort workaround for license restrictions that prohibit r If the requested file is present in the Nix store, the resulting derivation will not be built, because its expected output is already available. Otherwise, the builder will run, but fail with a message explaining to the user how to provide the file. The following code, for example: -``` +```nix requireFile { name = "jdk-${version}_linux-x64_bin.tar.gz"; url = "https://www.oracle.com/java/technologies/javase-jdk11-downloads.html"; @@ -270,7 +270,7 @@ It produces packages that cannot be built automatically. `fetchtorrent` expects two arguments. `url` which can either be a Magnet URI (Magnet Link) such as `magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c` or an HTTP URL pointing to a `.torrent` file. It can also take a `config` argument which will craft a `settings.json` configuration file and give it to `transmission`, the underlying program that is performing the fetch. The available config options for `transmission` can be found [here](https://github.com/transmission/transmission/blob/main/docs/Editing-Configuration-Files.md#options) -``` +```nix { fetchtorrent }: fetchtorrent { diff --git a/doc/languages-frameworks/cuelang.section.md b/doc/languages-frameworks/cuelang.section.md index 86304208aa20..70329b15fd7d 100644 --- a/doc/languages-frameworks/cuelang.section.md +++ b/doc/languages-frameworks/cuelang.section.md @@ -26,7 +26,7 @@ Cuelang schemas are similar to JSON, here is a quick cheatsheet: Nixpkgs provides a `pkgs.writeCueValidator` helper, which will write a validation script based on the provided Cuelang schema. Here is an example: -``` +```nix pkgs.writeCueValidator (pkgs.writeText "schema.cue" '' #Def1: { @@ -42,7 +42,7 @@ pkgs.writeCueValidator `document` : match your input data against this fragment of structure or definition, e.g. you may use the same schema file but different documents based on the data you are validating. Another example, given the following `validator.nix` : -``` +```nix { pkgs ? import <nixpkgs> {} }: let genericValidator = version: diff --git a/doc/languages-frameworks/dotnet.section.md b/doc/languages-frameworks/dotnet.section.md index 7466c8cdc228..6a6c899a0897 100644 --- a/doc/languages-frameworks/dotnet.section.md +++ b/doc/languages-frameworks/dotnet.section.md @@ -236,7 +236,7 @@ the packages inside the `out` directory. $ nuget-to-nix out > deps.nix ``` Which `nuget-to-nix` will generate an output similar to below -``` +```nix { fetchNuGet }: [ (fetchNuGet { pname = "FosterFramework"; version = "0.1.15-alpha"; sha256 = "0pzsdfbsfx28xfqljcwy100xhbs6wyx0z1d5qxgmv3l60di9xkll"; }) (fetchNuGet { pname = "Microsoft.AspNetCore.App.Runtime.linux-x64"; version = "8.0.1"; sha256 = "1gjz379y61ag9whi78qxx09bwkwcznkx2mzypgycibxk61g11da1"; }) diff --git a/doc/languages-frameworks/lisp.section.md b/doc/languages-frameworks/lisp.section.md index 09193093b08f..f64942338f80 100644 --- a/doc/languages-frameworks/lisp.section.md +++ b/doc/languages-frameworks/lisp.section.md @@ -45,7 +45,7 @@ $ sbcl Also one can create a `pkgs.mkShell` environment in `shell.nix`/`flake.nix`: -``` +```nix let sbcl' = sbcl.withPackages (ps: [ ps.alexandria ]); in mkShell { @@ -55,7 +55,7 @@ in mkShell { Such a Lisp can be now used e.g. to compile your sources: -``` +```nix buildPhase = '' ${sbcl'}/bin/sbcl --load my-build-file.lisp '' @@ -173,7 +173,7 @@ into the package scope with `withOverrides`. A package defined outside Nixpkgs using `buildASDFSystem` can be woven into the Nixpkgs-provided scope like this: -``` +```nix let alexandria = sbcl.buildASDFSystem rec { pname = "alexandria"; @@ -199,7 +199,7 @@ new package with different parameters. Example of overriding `alexandria`: -``` +```nix sbcl.pkgs.alexandria.overrideLispAttrs (oldAttrs: rec { version = "1.4"; src = fetchFromGitLab { @@ -225,7 +225,7 @@ vice versa. To package slashy systems, use `overrideLispAttrs`, like so: -``` +```nix ecl.pkgs.alexandria.overrideLispAttrs (oldAttrs: { systems = oldAttrs.systems ++ [ "alexandria/tests" ]; lispLibs = oldAttrs.lispLibs ++ [ ecl.pkgs.rt ]; @@ -290,7 +290,7 @@ derivation. This example wraps CLISP: -``` +```nix wrapLisp { pkg = clisp; faslExt = "fas"; diff --git a/doc/languages-frameworks/pkg-config.section.md b/doc/languages-frameworks/pkg-config.section.md index 75cbdaeb6fe8..72b99b40a1f3 100644 --- a/doc/languages-frameworks/pkg-config.section.md +++ b/doc/languages-frameworks/pkg-config.section.md @@ -12,7 +12,7 @@ Additionally, the [`validatePkgConfig` setup hook](https://nixos.org/manual/nixp A good example of all these things is zlib: -``` +```nix { pkg-config, testers, ... }: stdenv.mkDerivation (finalAttrs: { diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 049b395dcc25..174686d24c6c 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -1197,7 +1197,7 @@ a good indication that the package is not in a valid state. Pytest is the most common test runner for python repositories. A trivial test run would be: -``` +```nix nativeCheckInputs = [ pytest ]; checkPhase = '' runHook preCheck @@ -1213,7 +1213,7 @@ sandbox, and will generally need many tests to be disabled. To filter tests using pytest, one can do the following: -``` +```nix nativeCheckInputs = [ pytest ]; # avoid tests which need additional data or touch network checkPhase = '' @@ -1248,7 +1248,7 @@ when a package may need many items disabled to run the test suite. Using the example above, the analogous `pytestCheckHook` usage would be: -``` +```nix nativeCheckInputs = [ pytestCheckHook ]; @@ -1273,7 +1273,7 @@ Using the example above, the analogous `pytestCheckHook` usage would be: This is especially useful when tests need to be conditionally disabled, for example: -``` +```nix disabledTests = [ # touches network "download" @@ -1298,7 +1298,7 @@ all packages have test suites that can be run easily, and some have none at all. To help ensure the package still works, [`pythonImportsCheck`](#using-pythonimportscheck) can attempt to import the listed modules. -``` +```nix pythonImportsCheck = [ "requests" "urllib" @@ -1307,7 +1307,7 @@ the listed modules. roughly translates to: -``` +```nix postCheck = '' PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH python -c "import requests; import urllib" @@ -1342,7 +1342,7 @@ pkg3>=1.0,<=2.0 we can do: -``` +```nix nativeBuildInputs = [ pythonRelaxDepsHook ]; @@ -1365,7 +1365,7 @@ pkg3 Another option is to pass `true`, that will relax/remove all dependencies, for example: -``` +```nix nativeBuildInputs = [ pythonRelaxDepsHook ]; pythonRelaxDeps = true; ``` @@ -1392,7 +1392,7 @@ work with any of the [existing hooks](#setup-hooks). `unittestCheckHook` is a hook which will substitute the setuptools `test` command for a [`checkPhase`](#ssec-check-phase) which runs `python -m unittest discover`: -``` +```nix nativeCheckInputs = [ unittestCheckHook ]; @@ -1409,7 +1409,7 @@ using the popular Sphinx documentation generator. It is setup to automatically find common documentation source paths and render them using the default `html` style. -``` +```nix outputs = [ "out" "doc" @@ -1424,7 +1424,7 @@ The hook will automatically build and install the artifact into the `doc` output, if it exists. It also provides an automatic diversion for the artifacts of the `man` builder into the `man` target. -``` +```nix outputs = [ "out" "doc" @@ -1441,7 +1441,7 @@ for the artifacts of the `man` builder into the `man` target. Overwrite `sphinxRoot` when the hook is unable to find your documentation source root. -``` +```nix # Configure sphinxRoot for uncommon paths sphinxRoot = "weird/docs/path"; ``` @@ -1920,7 +1920,7 @@ The Python interpreters are by default not built with optimizations enabled, bec the builds are in that case not reproducible. To enable optimizations, override the interpreter of interest, e.g using -``` +```nix let pkgs = import ./. {}; mypython = pkgs.python3.override { diff --git a/doc/languages-frameworks/rust.section.md b/doc/languages-frameworks/rust.section.md index 274ee9ce9cc4..f978ac967d88 100644 --- a/doc/languages-frameworks/rust.section.md +++ b/doc/languages-frameworks/rust.section.md @@ -458,7 +458,7 @@ function does not require a hash (unless git dependencies are used) and fetches every dependency as a separate fixed-output derivation. `importCargoLock` can be used as follows: -``` +```nix cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; }; @@ -468,7 +468,7 @@ If the `Cargo.lock` file includes git dependencies, then their output hashes need to be specified since they are not available through the lock file. For example: -``` +```nix cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; outputHashes = { diff --git a/doc/languages-frameworks/swift.section.md b/doc/languages-frameworks/swift.section.md index 213d444f499f..67bcd6fbe741 100644 --- a/doc/languages-frameworks/swift.section.md +++ b/doc/languages-frameworks/swift.section.md @@ -147,7 +147,7 @@ them, we need to make them writable. A special function `swiftpmMakeMutable` is available to replace the symlink with a writable copy: -``` +```nix configurePhase = generated.configure ++ '' # Replace the dependency symlink with a writable copy. swiftpmMakeMutable swift-crypto diff --git a/doc/packages/darwin-builder.section.md b/doc/packages/darwin-builder.section.md index 3a547de53705..7225e630d5cc 100644 --- a/doc/packages/darwin-builder.section.md +++ b/doc/packages/darwin-builder.section.md @@ -81,7 +81,7 @@ $ sudo launchctl kickstart -k system/org.nixos.nix-daemon ## Example flake usage {#sec-darwin-builder-example-flake} -``` +```nix { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-22.11-darwin"; @@ -153,7 +153,7 @@ you may use it to build a modified remote builder with additional storage or mem To do this, you just need to set the `virtualisation.darwin-builder.*` parameters as in the example below and rebuild. -``` +```nix darwin-builder = nixpkgs.lib.nixosSystem { system = linuxSystem; modules = [ diff --git a/doc/stdenv/cross-compilation.chapter.md b/doc/stdenv/cross-compilation.chapter.md index e659e1803807..7ccd94f6e20e 100644 --- a/doc/stdenv/cross-compilation.chapter.md +++ b/doc/stdenv/cross-compilation.chapter.md @@ -159,7 +159,7 @@ Add `mesonEmulatorHook` to `nativeBuildInputs` conditionally on if the target bi e.g. -``` +```nix nativeBuildInputs = [ meson ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ diff --git a/nixos/doc/manual/release-notes/rl-2211.section.md b/nixos/doc/manual/release-notes/rl-2211.section.md index 1c73d0c9790d..5ad16d15c3d9 100644 --- a/nixos/doc/manual/release-notes/rl-2211.section.md +++ b/nixos/doc/manual/release-notes/rl-2211.section.md @@ -254,7 +254,7 @@ In addition to numerous new and upgraded packages, this release includes the fol - `services.github-runner` and `services.github-runners.<name>` gained the option `serviceOverrides` which allows overriding the systemd `serviceConfig`. If you have been overriding the systemd service configuration (i.e., by defining `systemd.services.github-runner.serviceConfig`), you have to use the `serviceOverrides` option now. Example: - ``` + ```nix services.github-runner.serviceOverrides.SupplementaryGroups = [ "docker" ]; diff --git a/nixos/doc/manual/release-notes/rl-2311.section.md b/nixos/doc/manual/release-notes/rl-2311.section.md index 1aef1828908f..eb6667b3fe8f 100644 --- a/nixos/doc/manual/release-notes/rl-2311.section.md +++ b/nixos/doc/manual/release-notes/rl-2311.section.md @@ -1228,7 +1228,7 @@ Make sure to also check the many updates in the [Nixpkgs library](#sec-release-2 - CoreDNS may be built with external plugins now. This may be done by overriding `externalPlugins` and `vendorHash` arguments like this: - ``` + ```nix services.coredns = { enable = true; package = pkgs.coredns.override { diff --git a/nixos/doc/manual/release-notes/rl-2405.section.md b/nixos/doc/manual/release-notes/rl-2405.section.md index 92702cce1896..0218621ae1c0 100644 --- a/nixos/doc/manual/release-notes/rl-2405.section.md +++ b/nixos/doc/manual/release-notes/rl-2405.section.md @@ -57,7 +57,7 @@ Use `services.pipewire.extraConfig` or `services.pipewire.configPackages` for Pi without perl). Previously, the NixOS activation depended on two perl scripts which can now be replaced via an opt-in mechanism. To make your system perlless, you can use the new perlless profile: - ``` + ```nix { modulesPath, ... }: { imports = [ "${modulesPath}/profiles/perlless.nix" ]; } diff --git a/nixos/modules/i18n/input-method/default.md b/nixos/modules/i18n/input-method/default.md index 42cb8a8d7b6a..3d56c97a1726 100644 --- a/nixos/modules/i18n/input-method/default.md +++ b/nixos/modules/i18n/input-method/default.md @@ -22,7 +22,7 @@ friendly input method user interface. The following snippet can be used to configure IBus: -``` +```nix i18n.inputMethod = { enabled = "ibus"; ibus.engines = with pkgs.ibus-engines; [ anthy hangul mozc ]; @@ -48,7 +48,7 @@ Available extra IBus engines are: methods, it must appear in the list of engines along with `table`. For example: - ``` + ```nix ibus.engines = with pkgs.ibus-engines; [ table table-others ]; ``` @@ -74,7 +74,7 @@ built-in Input Method Engine, Pinyin, QuWei and Table-based input methods. The following snippet can be used to configure Fcitx: -``` +```nix i18n.inputMethod = { enabled = "fcitx5"; fcitx5.addons = with pkgs; [ fcitx5-mozc fcitx5-hangul fcitx5-m17n ]; @@ -110,7 +110,7 @@ phonetic Korean characters (hangul) and pictographic Korean characters The following snippet can be used to configure Nabi: -``` +```nix i18n.inputMethod = { enabled = "nabi"; }; @@ -123,7 +123,7 @@ framework. Applications can use it through so-called bridges. The following snippet can be used to configure uim: -``` +```nix i18n.inputMethod = { enabled = "uim"; }; @@ -141,7 +141,7 @@ etc... The following snippet can be used to configure Hime: -``` +```nix i18n.inputMethod = { enabled = "hime"; }; @@ -153,7 +153,7 @@ Kime is Korean IME. it's built with Rust language and let you get simple, safe, The following snippet can be used to configure Kime: -``` +```nix i18n.inputMethod = { enabled = "kime"; }; diff --git a/nixos/modules/programs/digitalbitbox/default.md b/nixos/modules/programs/digitalbitbox/default.md index 9bca14e97ffe..c93d0f2b7f0a 100644 --- a/nixos/modules/programs/digitalbitbox/default.md +++ b/nixos/modules/programs/digitalbitbox/default.md @@ -4,7 +4,7 @@ Digital Bitbox is a hardware wallet and second-factor authenticator. The `digitalbitbox` programs module may be installed by setting `programs.digitalbitbox` to `true` in a manner similar to -``` +```nix programs.digitalbitbox.enable = true; ``` and bundles the `digitalbitbox` package (see [](#sec-digitalbitbox-package)), @@ -21,7 +21,7 @@ For more information, see <https://digitalbitbox.com/start_linux>. The binaries, `dbb-app` (a GUI tool) and `dbb-cli` (a CLI tool), are available through the `digitalbitbox` package which could be installed as follows: -``` +```nix environment.systemPackages = [ pkgs.digitalbitbox ]; @@ -31,13 +31,13 @@ environment.systemPackages = [ The digitalbitbox hardware package enables the udev rules for Digital Bitbox devices and may be installed as follows: -``` +```nix hardware.digitalbitbox.enable = true; ``` In order to alter the udev rules, one may provide different values for the `udevRule51` and `udevRule52` attributes by means of overriding as follows: -``` +```nix programs.digitalbitbox = { enable = true; package = pkgs.digitalbitbox.override { diff --git a/nixos/modules/programs/plotinus.md b/nixos/modules/programs/plotinus.md index fac3bbad1e08..b59d0d5c188b 100644 --- a/nixos/modules/programs/plotinus.md +++ b/nixos/modules/programs/plotinus.md @@ -12,6 +12,6 @@ palette provides a searchable list of of all menu items in the application. To enable Plotinus, add the following to your {file}`configuration.nix`: -``` +```nix programs.plotinus.enable = true; ``` diff --git a/nixos/modules/programs/zsh/oh-my-zsh.md b/nixos/modules/programs/zsh/oh-my-zsh.md index 6a310006edbf..7e4a41641eea 100644 --- a/nixos/modules/programs/zsh/oh-my-zsh.md +++ b/nixos/modules/programs/zsh/oh-my-zsh.md @@ -9,7 +9,7 @@ prompt themes. The module uses the `oh-my-zsh` package with all available features. The initial setup using Nix expressions is fairly similar to the configuration format of `oh-my-zsh`. -``` +```nix { programs.zsh.ohMyZsh = { enable = true; @@ -33,7 +33,7 @@ environment variable for this which points to a directory with additional scripts. The module can do this as well: -``` +```nix { programs.zsh.ohMyZsh.custom = "~/path/to/custom/scripts"; } @@ -48,7 +48,7 @@ which bundles completion scripts and a plugin for `oh-my-zsh`. Rather than using a single mutable path for `ZSH_CUSTOM`, it's also possible to generate this path from a list of Nix packages: -``` +```nix { pkgs, ... }: { programs.zsh.ohMyZsh.customPkgs = [ @@ -89,7 +89,7 @@ If third-party customizations (e.g. new themes) are supposed to be added to [upstream repo.](https://github.com/robbyrussell/oh-my-zsh/tree/91b771914bc7c43dd7c7a43b586c5de2c225ceb7/plugins) A derivation for `oh-my-zsh` may look like this: -``` +```nix { stdenv, fetchFromGitHub }: stdenv.mkDerivation rec { diff --git a/nixos/modules/services/backup/borgbackup.md b/nixos/modules/services/backup/borgbackup.md index 39141f6ec858..64d9e35720f1 100644 --- a/nixos/modules/services/backup/borgbackup.md +++ b/nixos/modules/services/backup/borgbackup.md @@ -21,7 +21,7 @@ A complete list of options for the Borgbase module may be found ## Basic usage for a local backup {#opt-services-backup-borgbackup-local-directory} A very basic configuration for backing up to a locally accessible directory is: -``` +```nix { opt.services.borgbackup.jobs = { { rootBackup = { @@ -59,7 +59,7 @@ ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID78zmOyA+5uPG4Ot0hfAy+sLDPU1L4AiIoRYEIVbbQ/ ``` Add the following snippet to your NixOS configuration: -``` +```nix { services.borgbackup.repos = { my_borg_repo = { @@ -80,7 +80,7 @@ that you have stored a secret passphrasse in the file {file}`/run/keys/borgbackup_passphrase`, which should be only accessible by root -``` +```nix { services.borgbackup.jobs = { backupToLocalServer = { diff --git a/nixos/modules/services/databases/foundationdb.md b/nixos/modules/services/databases/foundationdb.md index 0815c139152f..af17c9f95999 100644 --- a/nixos/modules/services/databases/foundationdb.md +++ b/ni |