1
0
Fork 0
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:
Aaron Honeycutt 2024-02-26 18:48:44 -07:00 committed by GitHub
parent 61c5b0f88e
commit 58b5a525c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 10 deletions

View file

@ -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:
```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.
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]$ mkdir 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.

View file

@ -10,7 +10,7 @@ For example, write a `shell.nix` with the following contents:
```nix
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 = []; };
in
@ -19,8 +19,8 @@ pkgs.mkShellNoCC {
hello
];
}
```
From the top-level directory of your project run:
```shell-session
@ -41,7 +41,7 @@ Make the following addition:
```diff
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 = []; };
in

View file

@ -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:
```{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 {
packages = with pkgs; [

View file

@ -49,7 +49,7 @@ Further assume your project is defined in `default.nix`:
```nix
# default.nix
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 = []; };
in
{
@ -62,7 +62,7 @@ Add an attribute to `default.nix` specifying an environment:
```diff
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 = []; };
in
{
@ -77,7 +77,7 @@ Then take the package's dependencies into the environment with [`inputsFrom`](ht
```diff
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 = []; };
+ build = pkgs.callPackage ./build.nix {};
in