|
1 | 1 | # 00 — Starting Line: installing Nix and playing around |
2 | 2 |
|
3 | | -Lorem in aliquip cupidatat cupidatat est mollit... |
| 3 | +Let's go ahead and install Nix. To do that, we'll use the |
| 4 | +**[nix-installer tool]** by Determinate Systems. This works on many platforms, |
| 5 | +but most importantly it works on **aarch64 Linux** and **x86_64 Linux**. Use the |
| 6 | +following command in your shell, **it should work on any Linux distro of your |
| 7 | +choice**: |
| 8 | + |
| 9 | +[nix-installer tool]: https://github.com/DeterminateSystems/nix-installer |
| 10 | + |
| 11 | +```bash |
| 12 | +curl \ |
| 13 | + --proto '=https' --tlsv1.2 \ |
| 14 | + -sSf -L https://install.determinate.systems/nix \ |
| 15 | +| sh -s -- install |
| 16 | +``` |
| 17 | + |
| 18 | +After you do this, **you must log in and log back out of your desktop |
| 19 | +environment** to get a new login session. This is so that your shell can have |
| 20 | +the Nix tools installed on `$PATH` and so that your user shell can see some |
| 21 | +extra settings. |
| 22 | + |
| 23 | +You should now be able to do something like the following; try running these |
| 24 | +same commands on your machine: |
| 25 | + |
| 26 | +``` |
| 27 | +$ nix --version |
| 28 | +nix (Nix) 2.16.1 |
| 29 | +``` |
| 30 | + |
| 31 | +``` |
| 32 | +$ nix run nixpkgs#nix-info -- -m |
| 33 | + - system: `"x86_64-linux"` |
| 34 | + - host os: `Linux 5.15.90.1-microsoft-standard-WSL2, Ubuntu, 22.04.2 LTS (Jammy Jellyfish), nobuild` |
| 35 | + - multi-user?: `yes` |
| 36 | + - sandbox: `yes` |
| 37 | + - version: `nix-env (Nix) 2.16.1` |
| 38 | + - channels(root): `"nixpkgs"` |
| 39 | + - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs` |
| 40 | +``` |
| 41 | + |
| 42 | +If the above worked, you're now cooking with gas! |
| 43 | + |
| 44 | +> _**NOTE**_: While there is an upstream tool to install Nix, written in Bash, |
| 45 | +> we use the Determinate Systems installer — which will hopefully replace the |
| 46 | +> original — because it's faster, and takes care of several extra edge cases |
| 47 | +> that the original one couldn't handle, and makes several changes to the |
| 48 | +> default installed configuration to make things more user friendly. Determinate |
| 49 | +> Systems is staffed by many long-time Nix contributors and the creator of Nix, |
| 50 | +> and is trustworthy. |
| 51 | +
|
| 52 | +## Do some fun stuff |
| 53 | + |
| 54 | +One of the best things about Nix that requires _very little_ knowledge of it is |
| 55 | +that it lets you install the latest and greatest versions of many tools _on any |
| 56 | +Linux distribution_. We'll explain more about that later on. But just as a few |
| 57 | +examples: |
| 58 | + |
| 59 | +- **Q**: I want the latest version of Deno. Can we get that? |
| 60 | +- **A**: `nix profile install nixpkgs#deno`, and you're done! |
| 61 | + |
| 62 | +<!-- break bulletpoints --> |
| 63 | + |
| 64 | +- **Q**: What about HTTPie? A nice Python application? |
| 65 | +- **A**: Same idea: `nix profile install nixpkgs#httpie` |
| 66 | + |
| 67 | +<!-- break bulletpoints --> |
| 68 | + |
| 69 | +- **Q**: What about my favorite Rust applications, like ripgrep and bat? |
| 70 | +- **A.1**: `nix profile install nixpkgs#ripgrep` |
| 71 | +- **A.2**: `nix profile install nixpkgs#bat` |
| 72 | +- **A.3**: And yes, you also have exa, fd, hyperfine, and more! |
| 73 | + |
| 74 | +<!-- break bulletpoints --> |
| 75 | + |
| 76 | +- **Q**: What does '`nixpkgs`' mean? And how can I find out more? |
| 77 | +- **A**: Please keep reading... |
| 78 | + |
| 79 | +## Next page |
| 80 | + |
| 81 | +TODO FIXME (aseipp): implement |
0 commit comments