mirror of
https://github.com/NixOS/nix.dev.git
synced 2024-10-18 14:32:43 -04:00
update examples to latest release of 23.11 (#913)
update examples to latest release of 23.11 Co-authored-by: Henrik <i97henka@gmail.com> Co-authored-by: Silvan Mosberger <github@infinisil.com>
This commit is contained in:
parent
61c5b0f88e
commit
58b5a525c2
|
@ -7,10 +7,10 @@ Nix expressions themselves can depend on remote sources, and there are multiple
|
||||||
For more automation around handling remote sources, set up [niv](https://github.com/nmattia/niv/) in your project:
|
For more automation around handling remote sources, set up [niv](https://github.com/nmattia/niv/) in your project:
|
||||||
|
|
||||||
```shell-session
|
```shell-session
|
||||||
$ nix-shell -p niv --run "niv init --nixpkgs nixos/nixpkgs --nixpkgs-branch nixos-23.05"
|
$ nix-shell -p niv --run "niv init --nixpkgs nixos/nixpkgs --nixpkgs-branch nixos-23.11"
|
||||||
```
|
```
|
||||||
|
|
||||||
This command will fetch the latest revision of the Nixpkgs 23.05 release branch.
|
This command will fetch the latest revision of the Nixpkgs 23.11 release branch.
|
||||||
In the current directory it will generate `nix/sources.json`, which will contain a pinned reference to the obtained revision.
|
In the current directory it will generate `nix/sources.json`, which will contain a pinned reference to the obtained revision.
|
||||||
It will also create `nix/sources.nix`, which exposes those dependencies as an attribute set.
|
It will also create `nix/sources.nix`, which exposes those dependencies as an attribute set.
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ Enter the development environment, create a new directory, and set up niv with a
|
||||||
$ nix-shell
|
$ nix-shell
|
||||||
[nix-shell]$ mkdir old
|
[nix-shell]$ mkdir old
|
||||||
[nix-shell]$ cd old
|
[nix-shell]$ cd old
|
||||||
[nix-shell]$ niv init --nixpkgs nixos/nixpkgs --nixpkgs-branch 18.09
|
[nix-shell]$ niv init --nixpkgs nixos/nixpkgs --nixpkgs-branch 21.11
|
||||||
```
|
```
|
||||||
|
|
||||||
Create a file `default.nix` in the new directory, and import the original one with the `sources` just created.
|
Create a file `default.nix` in the new directory, and import the original one with the `sources` just created.
|
||||||
|
|
|
@ -10,7 +10,7 @@ For example, write a `shell.nix` with the following contents:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
let
|
let
|
||||||
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-22.11";
|
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11";
|
||||||
pkgs = import nixpkgs { config = {}; overlays = []; };
|
pkgs = import nixpkgs { config = {}; overlays = []; };
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ pkgs.mkShellNoCC {
|
||||||
hello
|
hello
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
From the top-level directory of your project run:
|
From the top-level directory of your project run:
|
||||||
|
|
||||||
```shell-session
|
```shell-session
|
||||||
|
@ -41,7 +41,7 @@ Make the following addition:
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
let
|
let
|
||||||
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-22.11";
|
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11";
|
||||||
pkgs = import nixpkgs { config = {}; overlays = []; };
|
pkgs = import nixpkgs { config = {}; overlays = []; };
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ This is a simple Flask application which serves a JSON document with the message
|
||||||
Create a new file `shell.nix` to declare the development environment:
|
Create a new file `shell.nix` to declare the development environment:
|
||||||
|
|
||||||
```{code-block} nix shell.nix
|
```{code-block} nix shell.nix
|
||||||
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-22.11") {} }:
|
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11") {} }:
|
||||||
|
|
||||||
pkgs.mkShellNoCC {
|
pkgs.mkShellNoCC {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
|
|
|
@ -49,7 +49,7 @@ Further assume your project is defined in `default.nix`:
|
||||||
```nix
|
```nix
|
||||||
# default.nix
|
# default.nix
|
||||||
let
|
let
|
||||||
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-22.11";
|
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11";
|
||||||
pkgs = import nixpkgs { config = {}; overlays = []; };
|
pkgs = import nixpkgs { config = {}; overlays = []; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,7 @@ Add an attribute to `default.nix` specifying an environment:
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
let
|
let
|
||||||
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-22.11";
|
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11";
|
||||||
pkgs = import nixpkgs { config = {}; overlays = []; };
|
pkgs = import nixpkgs { config = {}; overlays = []; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ Then take the package's dependencies into the environment with [`inputsFrom`](ht
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
let
|
let
|
||||||
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-22.11";
|
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11";
|
||||||
pkgs = import nixpkgs { config = {}; overlays = []; };
|
pkgs = import nixpkgs { config = {}; overlays = []; };
|
||||||
+ build = pkgs.callPackage ./build.nix {};
|
+ build = pkgs.callPackage ./build.nix {};
|
||||||
in
|
in
|
||||||
|
|
Loading…
Reference in a new issue