Skip to content

Commit

Permalink
Update dependencies and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sukant Hajra committed Dec 10, 2024
1 parent f36d0f8 commit f17cdfb
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 87 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
# DESIGN: matching current in NixOS 24.05
install_url: https://releases.nixos.org/nix/nix-2.18.8/install
# DESIGN: matching current in NixOS 24.11
install_url: https://releases.nixos.org/nix/nix-2.24.10/install
- uses: cachix/cachix-action@v15
with:
name: shajra
Expand Down
6 changes: 3 additions & 3 deletions doc/internal/params.el
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
;; run-type must be "executable"
(run-target-short . "org2gfm")
;; run-target-long will always prefix "bin/"
(nix-latest . "2.24.10")
(nix-stable . "2.18.8")
(nixos-latest . "24.05")
(nix-latest . "2.25.3")
(nix-stable . "2.24.10")
(nixos-latest . "24.11")
(platforms . "\n\
- Linux on x86-64 machines\n\
- MacOS on x86-64 machines\n\
Expand Down
8 changes: 4 additions & 4 deletions doc/nix-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ Hopefully, this alleviates any worry about installing a complex program on your

> **<span class="underline">NOTE:</span>** You don't need this step if you're running NixOS, which comes with Nix baked in.
Though the latest version of Nix is Nix 2.24.10, we'll be installing the version that the last release of NixOS (24.05) uses, specifically Nix 2.18.8. As discussed in the included [introduction to Nix](nix-introduction.md), this version is considered stable by the Nix community.
Though the latest version of Nix is Nix 2.25.3, we'll be installing the version that the last release of NixOS (24.11) uses, specifically Nix 2.24.10. As discussed in the included [introduction to Nix](nix-introduction.md), this version is considered stable by the Nix community.

The following command calls the official installation script for the recommended version of Nix. Note, this script will require `sudo` access.

```bash
sh <(curl -L https://releases.nixos.org/nix/nix-2.18.8/install) --daemon
sh <(curl -L https://releases.nixos.org/nix/nix-2.24.10/install) --daemon
```

The `--daemon` switch installs Nix in the multi-user mode, which is generally recommended (single-user installation with `--no-daemon` instead is recommended for WSL). The script reports everything it does and touches.

After installation, you may have to exit your terminal session and log back in to have environment variables configured, which puts Nix executables on your `PATH`.

Every six months or so, a new version of NixOS releases, and you should consider upgrading your installation of Nix. For NixOS 24.05, this command upgrades Nix:
Every six months or so, a new version of NixOS releases, and you should consider upgrading your installation of Nix. For NixOS 24.11, this command upgrades Nix:

```bash
NIXOS_VERSION="24.05"
NIXOS_VERSION="24.11"
NIX_STORE_PATHS_URL=https://github.com/NixOS/nixpkgs/raw/$NIXOS_VERSION/nixos/module/installer/tools/nix-fallback-paths.nix
sudo nix upgrade-nix --nix-store-paths-url "$NIX_STORE_PATHS_URL"
```
Expand Down
6 changes: 3 additions & 3 deletions doc/nix-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,11 @@ However, if industrial users move to flakes to address these problems, we have t

### Nix quick releases compete with stability<a id="sec-4-2-3"></a>

The latest major version of the Nix package manager is currently Nix 2.24.10, but NixOS 24.05, the latest stable release of NixOS, uses Nix 2.18.8. NixOS is the primary way the Nix package manager gets used in the field. Far fewer users install Nix as a package manager atop another operating system. From a community perspective it makes sense to consider Nix 2.18.8 the stable release of the package manager. This version gets the most scrutiny and critical bug fixes.
The latest major version of the Nix package manager is currently Nix 2.25.3, but NixOS 24.11, the latest stable release of NixOS, uses Nix 2.24.10. NixOS is the primary way the Nix package manager gets used in the field. Far fewer users install Nix as a package manager atop another operating system. From a community perspective it makes sense to consider Nix 2.24.10 the stable release of the package manager. This version gets the most scrutiny and critical bug fixes.

As mentioned above, there are strong reasons to use still-experimental features, particularly flakes. However, APIs and calculated hashes change too frequently in experimental features from version-to-version. By sticking with the version used in NixOS, we get less breaking changes. For example, the [flake.lock](../flake.lock) file included with this project has calculated hashes for dependencies. These hashes were computed with Nix 2.18.8, and could change with later versions.
As mentioned above, there are strong reasons to use still-experimental features, particularly flakes. However, APIs and calculated hashes change too frequently in experimental features from version-to-version. By sticking with the version used in NixOS, we get less breaking changes. For example, the [flake.lock](../flake.lock) file included with this project has calculated hashes for dependencies. These hashes were computed with Nix 2.24.10, and could change with later versions.

For these reasons, the [installation guide included with this project](nix-installation.md) recommends installing Nix 2.18.8, rather than the latest official release.
For these reasons, the [installation guide included with this project](nix-installation.md) recommends installing Nix 2.24.10, rather than the latest official release.

## A few gaps in determinism<a id="sec-4-3"></a>

Expand Down
14 changes: 7 additions & 7 deletions doc/nix-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,13 @@ nix eval --impure --expr '
```

{
lastModified = 1718457448;
lastModifiedDate = "20240615131728";
narHash = "sha256-FSoxTcRZMGHNJh8dNtKOkcUtjhmhU6yQXcZZfUPLhQM=";
outPath = "/nix/store/z1lyf7s6klqvd97027b56lmckm5p9hik-source";
rev = "a0f54334df36770b335c051e540ba40afcbf8378";
revCount = 844;
shortRev = "a0f5433";
lastModified = 1731930289;
lastModifiedDate = "20241118114449";
narHash = "sha256-eOHQ7pD8OfSLIIFfF6daCnntzHKqpraAGFfFqSlPtbY=";
outPath = "/nix/store/n4yc76agwgn6racs698s5wnyn89mp5hl-source";
rev = "769337c227799aa60911562b6940530f4a86eb3c";
revCount = 870;
shortRev = "769337c";
submodules = false;
}

Expand Down
14 changes: 7 additions & 7 deletions doc/nix-language.org
Original file line number Diff line number Diff line change
Expand Up @@ -541,13 +541,13 @@ nix eval --impure --expr '
#+RESULTS:
#+begin_example
{
lastModified = 1718457448;
lastModifiedDate = "20240615131728";
narHash = "sha256-FSoxTcRZMGHNJh8dNtKOkcUtjhmhU6yQXcZZfUPLhQM=";
outPath = "/nix/store/z1lyf7s6klqvd97027b56lmckm5p9hik-source";
rev = "a0f54334df36770b335c051e540ba40afcbf8378";
revCount = 844;
shortRev = "a0f5433";
lastModified = 1731930289;
lastModifiedDate = "20241118114449";
narHash = "sha256-eOHQ7pD8OfSLIIFfF6daCnntzHKqpraAGFfFqSlPtbY=";
outPath = "/nix/store/n4yc76agwgn6racs698s5wnyn89mp5hl-source";
rev = "769337c227799aa60911562b6940530f4a86eb3c";
revCount = 870;
shortRev = "769337c";
submodules = false;
}
#+end_example
Expand Down
14 changes: 7 additions & 7 deletions doc/nix-usage-flakes.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ nix registry list

For example, rather than referencing the flake on the `nixpkgs-unstable` branch of the Nixpkgs GitHub repository with `github:NixOS/nixpkgs/nixpkgs-unstable`, we can use the simpler identifier `nixpkgs`.

If we want to point to a different branch but still use an identifier from the registry, we can do so by extending it with the branch. For example, the flakes identifier `nixpkgs` is the same as `nixpkgs/nixpkgs-ustable`, but we can also use `nixpkgs/nixos-24.05` to override the branch and point to the NixOS 24.05 release branch.
If we want to point to a different branch but still use an identifier from the registry, we can do so by extending it with the branch. For example, the flakes identifier `nixpkgs` is the same as `nixpkgs/nixpkgs-ustable`, but we can also use `nixpkgs/nixos-24.11` to override the branch and point to the NixOS 24.11 release branch.

Note that registries have mutable references, but Nix knows how to rebuild the snapshot referenced for some of these references deterministically. For example, when referencing a GitHub repository via a registry reference, Nix will take note of the commit ID of the snapshot retrieved. Nix typically stores this information required for reproducibility in a *lock file* called `flake.lock` adjacent to `flake.nix`.

Expand Down Expand Up @@ -223,13 +223,13 @@ nix search nixpkgs 'gpu|opengl|accel' terminal | ansifilter
If we're curious about what version of WezTerm is available in NixOS's latest release, we can specialize the installable we're searching as follows:

```sh
nix search nixpkgs/nixos-24.05#wezterm
nix search nixpkgs/nixos-24.11#wezterm
```

* legacyPackages.x86_64-linux.wezterm (20240203-110809-5046fc22)
GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust

Here `/nixos-24.05` overrides the default `nixpkgs-unstable` branch of the registry entry, and the `#wezterm` suffix searches not just the flake, but a specific package named `wezterm`, which will either be found or not (there's no need for regexes to filter further).
Here `/nixos-24.11` overrides the default `nixpkgs-unstable` branch of the registry entry, and the `#wezterm` suffix searches not just the flake, but a specific package named `wezterm`, which will either be found or not (there's no need for regexes to filter further).

You may also notice that the Nixpkgs flake outputs packages under the `legacyPackages` attribute instead of the `packages`. The primary difference is that packages are flatly organized under `packages`, while `legacyPackages` can be an arbitrary tree. `legacyPackages` exists specifically for the Nixpkgs project, a central project to the Nix ecosystem that has existed long before flakes. Beyond Nixpkgs, you don't have to think much about `legacyPackages`. Packages from all other flakes should generally be found under `packages`.

Expand Down Expand Up @@ -266,7 +266,7 @@ After a successful call of `nix build`, you'll see one or more symlinks for each
readlink result*
```

/nix/store/0hrm7139k2h5chl74bw0issgaxib361b-org2gfm
/nix/store/islqrpxqp250lq2f8mda3jfngbcm280l-org2gfm

Following these symlinks, we can see the files the project provides:

Expand All @@ -288,7 +288,7 @@ It's common to configure these “result” symlinks as ignored in source contro
nix path-info .#org2gfm
```

/nix/store/0hrm7139k2h5chl74bw0issgaxib361b-org2gfm
/nix/store/islqrpxqp250lq2f8mda3jfngbcm280l-org2gfm

## Running commands in a shell<a id="sec-4-6"></a>

Expand Down Expand Up @@ -401,7 +401,7 @@ nix shell --ignore-environment \
--command which org2gfm
```

/nix/store/0hrm7139k2h5chl74bw0issgaxib361b-org2gfm/bin/org2gfm
/nix/store/islqrpxqp250lq2f8mda3jfngbcm280l-org2gfm/bin/org2gfm

What we do with local flake references can work just as well with remote flake references.

Expand Down Expand Up @@ -429,7 +429,7 @@ nix profile list
Flake attribute: packages.x86_64-linux.org2gfm
Original flake URL: git+file:///home/shajra/src/nix-project
Locked flake URL: git+file:///home/shajra/src/nix-project
Store paths: /nix/store/0hrm7139k2h5chl74bw0issgaxib361b-org2gfm
Store paths: /nix/store/islqrpxqp250lq2f8mda3jfngbcm280l-org2gfm

If we want to uninstall a program from our profile, we do so by the index from this list:

Expand Down
8 changes: 4 additions & 4 deletions doc/nix-usage-flakes.org
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ readlink result*
#+end_src

#+RESULTS: nix-build-link
: /nix/store/0hrm7139k2h5chl74bw0issgaxib361b-org2gfm
: /nix/store/islqrpxqp250lq2f8mda3jfngbcm280l-org2gfm

Following these symlinks, we can see the files the project provides:

Expand Down Expand Up @@ -467,7 +467,7 @@ nix path-info .#<<get("package-attr-short")>>
#+end_src

#+results: nix-build-path
: /nix/store/0hrm7139k2h5chl74bw0issgaxib361b-org2gfm
: /nix/store/islqrpxqp250lq2f8mda3jfngbcm280l-org2gfm

** Running commands in a shell

Expand Down Expand Up @@ -629,7 +629,7 @@ nix shell --ignore-environment \
#+end_src

#+RESULTS: nix-shell-remote
: /nix/store/0hrm7139k2h5chl74bw0issgaxib361b-org2gfm/bin/org2gfm
: /nix/store/islqrpxqp250lq2f8mda3jfngbcm280l-org2gfm/bin/org2gfm

What we do with local flake references can work just as well with remote flake
references.
Expand Down Expand Up @@ -680,7 +680,7 @@ nix profile list --profile /tmp/nix-profile | ansifilter
: Flake attribute: packages.x86_64-linux.org2gfm
: Original flake URL: git+file:///home/shajra/src/nix-project
: Locked flake URL: git+file:///home/shajra/src/nix-project
: Store paths: /nix/store/0hrm7139k2h5chl74bw0issgaxib361b-org2gfm
: Store paths: /nix/store/islqrpxqp250lq2f8mda3jfngbcm280l-org2gfm

If we want to uninstall a program from our profile, we do so by the index from
this list:
Expand Down
9 changes: 4 additions & 5 deletions doc/nix-usage-noflakes.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ We can build this package with `nix-build` from the project root:
nix-build --attr packages.x86_64-linux.org2gfm .
```

/nix/store/0hrm7139k2h5chl74bw0issgaxib361b-org2gfm
/nix/store/islqrpxqp250lq2f8mda3jfngbcm280l-org2gfm

If we omit the path to a Nix file, `nix-build` will try to build `default.nix` in the current directory. If we omit the `--attr` switch and argument, `nix-build` will try to build packages it finds in the root of the attribute tree.

Expand All @@ -173,7 +173,7 @@ The output of `nix-build` shows us where in `/nix/store` our package has been bu
readlink result*
```

/nix/store/0hrm7139k2h5chl74bw0issgaxib361b-org2gfm
/nix/store/islqrpxqp250lq2f8mda3jfngbcm280l-org2gfm

Following these symlinks, we can see the files the project provides:

Expand Down Expand Up @@ -269,12 +269,12 @@ If we want something other than what can be detected, then we have to continue u

The previous sections show how to use `nix run` and `nix shell` to run commands in an environment that includes packages from a project local to our filesystem.

We can reference remote projects that have a `default.nix` file using URLs with the `--file` switch. For example, here we reference a tarball of the 24.05 release of Nixpkgs:
We can reference remote projects that have a `default.nix` file using URLs with the `--file` switch. For example, here we reference a tarball of the 24.11 release of Nixpkgs:

```sh
nix --extra-experimental-features 'nix-command' \
run \
--file https://github.com/NixOS/nixpkgs/archive/24.05.tar.gz \
--file https://github.com/NixOS/nixpkgs/archive/nixos-24.11.tar.gz \
hello
```

Expand Down Expand Up @@ -305,7 +305,6 @@ nix-env --install --file . --attr packages.x86_64-linux.org2gfm 2>&1
```

installing 'org2gfm'
building '/nix/store/hs9xz17vlb2m4qn6kxfmccgjq4jyrvqg-user-environment.drv'...

We can see this installation by querying what's been installed:

Expand Down
9 changes: 4 additions & 5 deletions doc/nix-usage-noflakes.org
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ nix-build --attr <<get("package-attr-long")>> .
#+end_src

#+RESULTS: nix-build
: /nix/store/0hrm7139k2h5chl74bw0issgaxib361b-org2gfm
: /nix/store/islqrpxqp250lq2f8mda3jfngbcm280l-org2gfm

If we omit the path to a Nix file, =nix-build= will try to build =default.nix=
in the current directory. If we omit the =--attr= switch and argument,
Expand All @@ -328,7 +328,7 @@ readlink result*
#+end_src

#+RESULTS: nix-build-link
: /nix/store/0hrm7139k2h5chl74bw0issgaxib361b-org2gfm
: /nix/store/islqrpxqp250lq2f8mda3jfngbcm280l-org2gfm

Following these symlinks, we can see the files the project provides:

Expand Down Expand Up @@ -490,15 +490,15 @@ the =--file= switch. For example, here we reference a tarball of the
#+begin_src sh :eval no :noweb yes
nix --extra-experimental-features 'nix-command' \
run \
--file https://github.com/NixOS/nixpkgs/archive/<<get("nixos-latest")>>.tar.gz \
--file https://github.com/NixOS/nixpkgs/archive/nixos-<<get("nixos-latest")>>.tar.gz \
hello
#+end_src

#+name: nix-run-remote
#+begin_src sh :results output :exports results :noweb yes
nix --experimental-features 'nix-command' \
run \
--file https://github.com/NixOS/nixpkgs/archive/<<get("nixos-latest")>>.tar.gz \
--file https://github.com/NixOS/nixpkgs/archive/nixos-<<get("nixos-latest")>>.tar.gz \
hello
#+end_src

Expand Down Expand Up @@ -557,7 +557,6 @@ nix-env --profile /tmp/nix-profile \

#+RESULTS: nix-env-install
: installing 'org2gfm'
: building '/nix/store/hs9xz17vlb2m4qn6kxfmccgjq4jyrvqg-user-environment.drv'...

We can see this installation by querying what's been installed:

Expand Down
10 changes: 5 additions & 5 deletions doc/project-developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Every `flake.nix` file must conform to a standard structure of an attribute set
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
flake-parts.url = "github:hercules-ci/flake-parts";
nix-project.url = "github:shajra/nix-project";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
};
outputs = inputs@{ flake-parts, nix-project, ... }:
# …
Expand Down Expand Up @@ -213,7 +213,7 @@ For example, let's say we wanted to pass through GNU Hello as a package provided
{
description = "Without flake-parts";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
};
outputs = inputs: {
packages.x86_64-linux.my-hello =
Expand All @@ -230,7 +230,7 @@ This example not using `flake-parts` may not seem that bad when just passing thr
{
description = "Motivating flake-parts";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
};
outputs = inputs:
let lib = inputs.nixpkgs.lib;
Expand All @@ -252,7 +252,7 @@ Notice how annoying it is to deal with the `system` parameter. Here's what the s
description = "Illustrating flake-parts";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
Expand Down Expand Up @@ -280,7 +280,7 @@ See the [official flake-parts documentation](https://flake.parts/module-argument
description = "Illustrating flake-parts";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
Expand Down
Loading

0 comments on commit f17cdfb

Please sign in to comment.