diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/build-helpers/fetchers.chapter.md | 4 | ||||
-rw-r--r-- | doc/languages-frameworks/cuelang.section.md | 4 | ||||
-rw-r--r-- | doc/languages-frameworks/dotnet.section.md | 2 | ||||
-rw-r--r-- | doc/languages-frameworks/lisp.section.md | 12 | ||||
-rw-r--r-- | doc/languages-frameworks/pkg-config.section.md | 2 | ||||
-rw-r--r-- | doc/languages-frameworks/python.section.md | 26 | ||||
-rw-r--r-- | doc/languages-frameworks/rust.section.md | 4 | ||||
-rw-r--r-- | doc/languages-frameworks/swift.section.md | 2 | ||||
-rw-r--r-- | doc/packages/darwin-builder.section.md | 4 | ||||
-rw-r--r-- | doc/stdenv/cross-compilation.chapter.md | 2 |
10 files changed, 31 insertions, 31 deletions
diff --git a/doc/build-helpers/fetchers.chapter.md b/doc/build-helpers/fetchers.chapter.md index b326f189d50ea..e8521861208fe 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 86304208aa20c..70329b15fd7dd 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 7466c8cdc2287..6a6c899a08971 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 09193093b08fa..f64942338f806 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 75cbdaeb6fe88..72b99b40a1f38 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 049b395dcc25c..174686d24c6cf 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 274ee9ce9cc4a..f978ac967d881 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 213d444f499fa..67bcd6fbe741d 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 3a547de537054..7225e630d5cc1 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 e659e1803807a..7ccd94f6e20ec 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) [ |