diff --git a/src/pages/breeze.mdx b/src/pages/breeze.mdx new file mode 100644 index 00000000..b456aa1b --- /dev/null +++ b/src/pages/breeze.mdx @@ -0,0 +1,116 @@ +--- +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] + +If you're intrigued and would like to go further, check out the [quick start][start]. + + +## Get Nix running \{#up} + +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 +``` + +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, Nix!\n\nSo happy to be here.' > hello.md +nix run "nixpkgs#bat" -- 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 +nix build "nixpkgs#bat" +``` + +## Install + +```shell +nix profile install "nixpkgs#ponysay" +``` + +```shell +echo "Hello Nix" | ponysay +``` + +## Uninstall Nix \{#uninstall} + +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. + + +[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 +[systemd]: https://systemd.io +[z2n]: / diff --git a/src/site.ts b/src/site.ts index df8b954d..918e5dd3 100644 --- a/src/site.ts +++ b/src/site.ts @@ -44,9 +44,13 @@ 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: "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" }, ],