summaryrefslogtreecommitdiffstats
path: root/doc/languages-frameworks
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2024-03-27 17:33:27 +0100
committerValentin Gagarin <valentin.gagarin@tweag.io>2024-03-28 09:28:12 +0100
commitbc77c7a9730833c7668c92288c6af950e7270cb5 (patch)
tree63a416edaa93c9899044ca886aaf6976474946ed /doc/languages-frameworks
parent3a1b8df5dcf930de90b45694dd3ee5d142344123 (diff)
treewide: Mark Nix blocks in markdown as Nix
This should help us with highlighting and future formatting.
Diffstat (limited to 'doc/languages-frameworks')
-rw-r--r--doc/languages-frameworks/cuelang.section.md4
-rw-r--r--doc/languages-frameworks/dotnet.section.md2
-rw-r--r--doc/languages-frameworks/lisp.section.md12
-rw-r--r--doc/languages-frameworks/pkg-config.section.md2
-rw-r--r--doc/languages-frameworks/python.section.md26
-rw-r--r--doc/languages-frameworks/rust.section.md4
-rw-r--r--doc/languages-frameworks/swift.section.md2
7 files changed, 26 insertions, 26 deletions
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