Skip to content

Commit 00983e6

Browse files
authored
Merge pull request DeterminateSystems#350 from DeterminateSystems/nixpkgs-flakehub
Use Nixpkgs from FlakeHub in quick start
2 parents 8deecdc + ac3ae10 commit 00983e6

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

src/pages/start/2.nix-run.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Now we can dive in and use Nix to run an actual program.
1414
Let's try running the delightful [ponysay]:
1515

1616
```shell
17-
echo "Hello Nix" | nix run "nixpkgs#ponysay"
17+
echo "Hello Nix" | nix run "https://flakehub.com/f/NixOS/nixpkgs/*#ponysay"
1818
```
1919

2020
:rocket: **Success**!
@@ -31,7 +31,7 @@ Future `nix run` invocations should be instantaneous, as Nix doesn't need to bui
3131

3232
What happened here? The [Nix] CLI did a few things:
3333

34-
* It used the `nixpkgs` [flake reference][ref] to pull in some Nix code and targeted the `ponysay` [flake output][output] (more on this later).
34+
* It used a [flake reference][ref] to [Nixpkgs] to pull in some Nix code and targeted the `ponysay` [flake output][output] (more on this later).
3535
* It built the [`ponysay` package][ponysay] and stored the result in the [Nix store][store].
3636
* It ran the executable at `bin/ponysay` from the `ponysay` package.
3737

src/pages/start/3.nix-develop.mdx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Explore Nix development environments
33
path: /start/nix-develop
44
summary: [
5-
"Use the `nix develop` command to activate a Nix development environment defined in [Nixpkgs](/concepts/nixpkgs)",
5+
"Use the `nix develop` command to activate a Nix development environment",
66
"Run a command inside a development environment without actually entering that environment",
77
"Explore Nix development environments tailored to specific programming languages",
88
"Explore a more mixed development environment",
@@ -17,7 +17,7 @@ We'll cover that a bit later, but for now let's get a feel for what a Nix develo
1717
The [`nix develop`][nix-develop] command activates a Nix environment:
1818

1919
```shell
20-
nix develop "github:DeterminateSystems/zero-to-nix#example"
20+
nix develop "https://flakehub.com/f/DeterminateSystems/zero-to-nix/*#example"
2121
```
2222

2323
<Admonition warning title="This could take a while" id="nix-develop-loading" client:load>
@@ -30,7 +30,7 @@ Future `nix develop` invocations should be much faster, as Nix doesn't need to b
3030
You should be greeted by a new shell prompt, something like this:
3131

3232
```shell
33-
(nix:zero-to-nix-env) bash-5.1$
33+
(nix:zero-to-nix-env) bash-5.2$
3434
```
3535

3636
:rocket: **Success**!
@@ -44,11 +44,11 @@ type git
4444

4545
For curl, for example, you should see a strange path like this (the hash part should be different on your machine):
4646

47-
<NixStorePath pkg="curl-7.86.0-bin" bin="curl" />
47+
<NixStorePath pkg="curl-8.1.1-bin" bin="curl" />
4848

4949
What happened here? The [Nix] CLI did a few things:
5050

51-
* It used the `github:DeterminateSystems/zero-to-nix` [flake reference][flakes] to pull in some Nix code and built a specific [flake output][output] (more on this later).
51+
* It used the `https://flakehub.com/f/DeterminateSystems/zero-to-nix/*#example` [flake reference][flakes] to pull in some Nix code and built a specific [flake output][output] (more on this later).
5252
* It built the [packages] specified in the environment configuration (again, more on this later).
5353
* It set up an environment with a [`PATH`][path] that enables the `git` and `curl` packages to be discovered in the [Nix store][store].
5454

@@ -62,10 +62,10 @@ Two other things that you can provide in Nix development environments:
6262
Run this to see an example shell hook:
6363

6464
```shell
65-
nix develop "github:DeterminateSystems/zero-to-nix#hook"
65+
nix develop "https://flakehub.com/f/DeterminateSystems/zero-to-nix/*#hook"
6666
```
6767
1. Nix development environments support environment variables as well.
68-
Run `echo $FUNNY_JOKE` to access a (hilarious) value that's available only in the Nix environment.
68+
Run `echo $FUNNY_JOKE` to access a (hilarious) value that's available only in the Nix environment (then run `exit` to leave the environment).
6969
Some example use cases for environment variables:
7070
* Set logging levels using `LOG_LEVEL` or whatever is appropriate for the tools you're using.
7171
* Set the environment using variables like `NODE_ENV` (for [Node.js]) to `development`, `dev`, and so on.
@@ -87,8 +87,8 @@ The `nix develop` command provides a `--command` (or `-c`) flag that you can use
8787
Here are some examples for the environment we used earlier:
8888

8989
```shell
90-
nix develop "github:DeterminateSystems/zero-to-nix#example" --command git help
91-
nix develop "github:DeterminateSystems/zero-to-nix#example" --command curl https://example.com
90+
nix develop "https://flakehub.com/f/DeterminateSystems/zero-to-nix/*#example" --command git help
91+
nix develop "https://flakehub.com/f/DeterminateSystems/zero-to-nix/*#example" --command curl https://example.com
9292
```
9393

9494
In both cases, you're running a package in the [Nix store][store] and nothing from your global environment.
@@ -212,7 +212,7 @@ But Nix environments are infinitely flexible, enabling you to combine whichever
212212
Let's explore an example of this:
213213

214214
```shell
215-
nix develop "github:DeterminateSystems/zero-to-nix#multi"
215+
nix develop "https://flakehub.com/f/DeterminateSystems/zero-to-nix/*#multi"
216216
```
217217

218218
This Nix environment has several tools available:
@@ -235,7 +235,7 @@ For more info, see [Effortless dev environments with Nix and direnv][nix-direnv]
235235

236236
## From a local flake \{#flake}
237237

238-
Earlier in this guide, we activated a Nix development environment defined in a [flake][flakes] on GitHub.
238+
Earlier in this guide, we activated a Nix development environment defined in a [flake][flakes] on [FlakeHub].
239239
While using an environment in this way is helpful, it's more common to use a development environment defined in a local flake in the current directory.
240240

241241
First, tell us which language you prefer:
@@ -374,6 +374,7 @@ Probably not what you expected! What happened here? A few things:
374374
[curl]: https://curl.se
375375
[dev]: /concepts/dev-env
376376
[direnv]: https://direnv.net
377+
[flakehub]: https://flakehub.com
377378
[flakes]: /concepts/flakes
378379
[ghc]: https://haskell.org/ghc
379380
[git]: https://git-scm.com

src/pages/start/4.nix-build.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Let's start by building [bat], a syntax-highlighted version of [cat] written in
1717

1818
```shell
1919
mkdir build-nix-package && cd build-nix-package
20-
nix build "nixpkgs#bat"
20+
nix build "https://flakehub.com/f/NixOS/nixpkgs/*#bat"
2121
```
2222

2323
Here, `nixpkgs` is a [flake reference][ref] to the [NixOS/nixpkgs][nixpkgs-repo] repository on GitHub, while `#bat` indicates that we're building the `bat` output from the Nixpkgs flake.
@@ -119,10 +119,11 @@ nix build "nixpkgs#scalafmt"
119119
While [Nixpkgs] is by far the largest Nix package repository in the known universe, any [Nix flake][flake] can include package [outputs]. Let's build a package from a different repo, this time the package for [Home Manager][hm], a popular Nix tool for configuring home environments:
120120

121121
```shell
122-
nix build "github:nix-community/home-manager"
122+
nix build "https://flakehub.com/f/nix-community/home-manager/*"
123123
```
124124

125-
Here, `github:nix-community/home-manager` is a flake reference to the [nix-community/home-manager][hm] repo on GitHub. To run Home Manager:
125+
Here, `https://flakehub.com/f/nix-community/home-manager/*` is a flake reference to the [nix-community/home-manager][hm] repo on FlakeHub.
126+
To run Home Manager:
126127

127128
```shell
128129
./result/bin/home-manager --help

src/pages/start/5.nix-search.mdx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ Let's start by searching [Nixpkgs], which is where we're mostly likely to find p
2121
This command will tell us if [cargo] is available in [Nixpkgs]:
2222

2323
```shell
24-
nix search nixpkgs cargo
24+
nix search "https://flakehub.com/f/NixOS/nixpkgs/*" cargo
2525
```
2626

27-
In this command, the `nixpkgs` [flake reference][flake-ref] is shorthand for `github:NixOS/nixpkgs`.
28-
2927
<Admonition warning title="This could take a while" id="nix-search" client:load>
3028
The first time you run `nix search`, the Nix CLI needs to download the full Nix code contents of [Nixpkgs]&mdash;or whichever flake you're searching&mdash;and then cache it.
31-
Future `nix search` runs for Nixpkgs should be much speedier.
29+
Future `nix search` runs should be much speedier.
3230
Furthermore, Nixpkgs is the largest flake in existence and running `nix search` on other flakes should be much faster in general.
3331
</Admonition>
3432

@@ -67,7 +65,7 @@ The web interface at [search.nixos.org][search] has a few advantages over the [`
6765
As an example, let's explore a popular flake for the [Wayland] window system protocol.
6866
6967
```shell
70-
nix flake show github:nix-community/nixpkgs-wayland
68+
nix flake show "github:nix-community/nixpkgs-wayland"
7169
```
7270
7371
<Admonition warning title="This could take a while" id="nix-search" client:load>

0 commit comments

Comments
 (0)