From 879dd41f9266248e5119deca6d3092920b49b723 Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Mon, 6 Feb 2023 11:50:48 -0800 Subject: [PATCH 1/4] Add initial doc --- src/pages/breeze.mdx | 45 ++++++++++++++++++++++++++++++++++++++++++++ src/site.ts | 3 ++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/pages/breeze.mdx diff --git a/src/pages/breeze.mdx b/src/pages/breeze.mdx new file mode 100644 index 00000000..5c0cbe12 --- /dev/null +++ b/src/pages/breeze.mdx @@ -0,0 +1,45 @@ +--- +title: The Nix breeze +description: Learn Nix in one page +layout: plain +--- + +## Get Nix running \{#up} + +```shell +curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install +``` + +## Run + +```shell +echo "Hello Nix" | nix run "nixpkgs#ponysay" +``` + +## Develop + +```shell +nix develop "github:DeterminateSystems/zero-to-nix#example" +``` + +## Build + +```shell +nix build "nixpkgs#bat" +``` + +```shell +echo "# Hello" > hello.md +nix run nixpkgs#bat -- hello.md +rm hello.md +``` + +## Install + +```shell +nix profile install "nixpkgs#ponysay" +``` + +```shell +echo "Hello Nix" | ponysay +``` diff --git a/src/site.ts b/src/site.ts index 880647f1..82048ff2 100644 --- a/src/site.ts +++ b/src/site.ts @@ -46,7 +46,8 @@ const site: Site = { languageCode: "en", navbarLinks: [{ text: "About", href: "/about" }], heroButtons: [ - { text: "Quick start", href: "/start/install", highlight: true }, + { text: "Breeze", href: "/breeze", highlight: true }, + { text: "Quick start", href: "/start/install" }, { text: "Concepts", href: "/concepts" }, { text: "About", href: "/about" }, ], From 66d03d1f5805a67f289df6b75ca925c5a200dc2d Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Wed, 8 Feb 2023 09:29:26 -0800 Subject: [PATCH 2/4] Add installation steps --- src/pages/breeze.mdx | 33 ++++++++++++++++++++++++++++++++- src/site.ts | 5 ++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/pages/breeze.mdx b/src/pages/breeze.mdx index 5c0cbe12..ec55599a 100644 --- a/src/pages/breeze.mdx +++ b/src/pages/breeze.mdx @@ -1,15 +1,29 @@ --- title: The Nix breeze -description: Learn Nix in one page layout: plain --- + +We wrote this [Zero to Nix][z2n] breeze with one specific audience in mind: people who have heard about [Nix] but don't yet know much about it and aren't quite sure where to start with the learning process. +In this one-page guide, we'll install Nix and use it + +If you'd like to go further, check out the [Nix quick start][start] + + ## Get Nix running \{#up} +First, install [Nix] using [Nix Installer][installer], an unofficial and experimental Nix installer from [Determinate Systems][ds]: + ```shell curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install ``` +Nix Installer supports these platforms: + +* Multi-user Linux with [systemd] init on 64-bit ARM and 64-bit AMD/Intel (no [SELinux]) +* Multi-user macOS on 64-bit ARM and 64-bit AMD/Intel +* [Valve Steam Deck][steamdeck] + ## Run ```shell @@ -43,3 +57,20 @@ nix profile install "nixpkgs#ponysay" ```shell echo "Hello Nix" | ponysay ``` + +## Uninstall Nix \{#uninstall} + +In case you need to uninstall Nix: + +```shell +/nix/nix-installer uninstall +``` + +[ds]: https://determinate.systems +[installer]: /concepts/nix-installer +[nix]: /concepts/nix +[selinux]: https://www.redhat.com/en/topics/linux/what-is-selinux +[start]: /start +[steamdeck]: https://steamdeck.com +[systemd]: https://systemd.io +[z2n]: / diff --git a/src/site.ts b/src/site.ts index 82048ff2..b0f432bb 100644 --- a/src/site.ts +++ b/src/site.ts @@ -44,7 +44,10 @@ const site: Site = { canonical: "zero-to-nix.com", githubUrl: "https://github.com/DeterminateSystems/zero-to-nix", languageCode: "en", - navbarLinks: [{ text: "About", href: "/about" }], + navbarLinks: [ + { text: "Breeze", href: "/breeze" }, + { text: "About", href: "/about" }, + ], heroButtons: [ { text: "Breeze", href: "/breeze", highlight: true }, { text: "Quick start", href: "/start/install" }, From 12ab64d43bfb22591dcebe8fb700f4e434b3f438 Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Mon, 6 Mar 2023 13:43:14 +0200 Subject: [PATCH 3/4] Add to opening section --- src/pages/breeze.mdx | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/pages/breeze.mdx b/src/pages/breeze.mdx index ec55599a..d1dc1835 100644 --- a/src/pages/breeze.mdx +++ b/src/pages/breeze.mdx @@ -5,9 +5,9 @@ layout: plain We wrote this [Zero to Nix][z2n] breeze with one specific audience in mind: people who have heard about [Nix] but don't yet know much about it and aren't quite sure where to start with the learning process. -In this one-page guide, we'll install Nix and use it +In this one-page guide, we'll [install Nix](#up) and use it to do some things that people often do with Nix, such as [running a program](#run) without needing to install it, using a [Nix development environment](#develop), [building](#build) a Nix [package] -If you'd like to go further, check out the [Nix quick start][start] +If you're intrigued and would like to go further, check out the [quick start][start]. ## Get Nix running \{#up} @@ -30,6 +30,12 @@ Nix Installer supports these platforms: echo "Hello Nix" | nix run "nixpkgs#ponysay" ``` +```shell +echo "# Hello" > hello.md +nix run "nixpkgs#bat" -- hello.md +rm hello.md +``` + ## Develop ```shell @@ -42,12 +48,6 @@ nix develop "github:DeterminateSystems/zero-to-nix#example" nix build "nixpkgs#bat" ``` -```shell -echo "# Hello" > hello.md -nix run nixpkgs#bat -- hello.md -rm hello.md -``` - ## Install ```shell @@ -60,15 +60,23 @@ echo "Hello Nix" | ponysay ## Uninstall Nix \{#uninstall} -In case you need to uninstall Nix: +While we'd love for you to keep using Nix, you can uninstall it at any time if you need to: ```shell /nix/nix-installer uninstall ``` + +The ability to seamlessly uninstall Nix from your system is one of the differentiating features of the [Determinate Nix Installer][dni]. +If you install Nix using the [official installer][official], by contrast, you'd need to uninstall Nix manually. + + +[dni]: /concepts/nix-installer [ds]: https://determinate.systems [installer]: /concepts/nix-installer [nix]: /concepts/nix +[official]: https://nixos.org/download +[package]: /concepts/packages [selinux]: https://www.redhat.com/en/topics/linux/what-is-selinux [start]: /start [steamdeck]: https://steamdeck.com From 88fe0e95e35ad084a7a562d74d430adef2139838 Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Mon, 6 Mar 2023 18:08:30 +0200 Subject: [PATCH 4/4] More snippets --- src/pages/breeze.mdx | 50 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/src/pages/breeze.mdx b/src/pages/breeze.mdx index d1dc1835..b456aa1b 100644 --- a/src/pages/breeze.mdx +++ b/src/pages/breeze.mdx @@ -3,7 +3,7 @@ title: The Nix breeze layout: plain --- - + We wrote this [Zero to Nix][z2n] breeze with one specific audience in mind: people who have heard about [Nix] but don't yet know much about it and aren't quite sure where to start with the learning process. In this one-page guide, we'll [install Nix](#up) and use it to do some things that people often do with Nix, such as [running a program](#run) without needing to install it, using a [Nix development environment](#develop), [building](#build) a Nix [package] @@ -12,36 +12,59 @@ If you're intrigued and would like to go further, check out the [quick start][st ## Get Nix running \{#up} -First, install [Nix] using [Nix Installer][installer], an unofficial and experimental Nix installer from [Determinate Systems][ds]: +First, install [Nix] using the [Determinate Nix Installer][installer], an unofficial and experimental tool from [Determinate Systems][ds]: ```shell curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install ``` -Nix Installer supports these platforms: - -* Multi-user Linux with [systemd] init on 64-bit ARM and 64-bit AMD/Intel (no [SELinux]) -* Multi-user macOS on 64-bit ARM and 64-bit AMD/Intel -* [Valve Steam Deck][steamdeck] +Our installer supports [several platforms][platforms]. ## Run +Nix enables you to [run] programs without a separate installation step. +This runs [ponysay], one of the many packages available in [Nixpkgs]: + ```shell echo "Hello Nix" | nix run "nixpkgs#ponysay" ``` + +The first time you run a program using `nix run` it's likely to be a slow operation. +Subsequent runs should be instantaneous. + + +Let's try a slightly more realistic example and use [bat] to render some Markdown in our terminal: + ```shell -echo "# Hello" > hello.md +echo '# Hello, Nix!\n\nSo happy to be here.' > hello.md nix run "nixpkgs#bat" -- hello.md -rm hello.md +rm hello.md # let's clean up after ourselves ``` ## Develop +Running programs in a one-off way is good for experimentation, but more often you'll want to create [development environments][dev-env] for specific projects. +Run this to activate one: + ```shell nix develop "github:DeterminateSystems/zero-to-nix#example" ``` + +The first time you activate a development environment using `nix develop` it's likely to be a slow operation. +Subsequent activations should be much speedier. + + +This development environment provides specific versions of [curl], [jq], and [Git]. +You should enter a shell with this prompt: + +```shell +(nix:zero-to-nix-env) bash-5.1$ +``` + +Run `type git` to see where Git + ## Build ```shell @@ -71,12 +94,21 @@ The ability to seamlessly uninstall Nix from your system is one of the different If you install Nix using the [official installer][official], by contrast, you'd need to uninstall Nix manually. +[bat]: https://github.com/sharkdp/bat +[curl]: https://curl.se +[dev-env]: /concepts/dev-env [dni]: /concepts/nix-installer [ds]: https://determinate.systems +[git]: https://git-scm.com [installer]: /concepts/nix-installer +[jq]: https://stedolan.github.io/jq [nix]: /concepts/nix +[nixpkgs]: /concepts/nixpkgs [official]: https://nixos.org/download [package]: /concepts/packages +[platforms]: /start/install +[ponysay]: https://github.com/erkin/ponysay +[run]: /start/nix-run [selinux]: https://www.redhat.com/en/topics/linux/what-is-selinux [start]: /start [steamdeck]: https://steamdeck.com