Skip to content

Commit

Permalink
Space should be part of the prompt
Browse files Browse the repository at this point in the history
otherwise it gets copied
  • Loading branch information
garbas committed Jul 7, 2020
1 parent c77b251 commit 0f2285f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
12 changes: 6 additions & 6 deletions download.tt
Expand Up @@ -22,19 +22,19 @@
The quickest way to install Nix is to open a terminal and run the following
command (as a user other than <code>root</code> with <code>sudo</code> permission):
<pre class="well" style="margin-top:1em">
<span class="shell-prompt">$</span> curl -L https://nixos.org/nix/install | sh</pre>
<span class="shell-prompt">$ </span>curl -L https://nixos.org/nix/install | sh</pre>
<p>Make sure to follow the instructions output by the script.</p>
<p>The installation script requires that you have <code>sudo</code> access to <code>root</code>.</p>
</section>

<section class="tab-pane" id="nix-verify-installation">
<p>You may want to verify the integrity of the installation script using GPG:</p>
<pre class="well">
<span class="shell-prompt">$</span> curl -o install-nix-[%latestNixVersion%] https://releases.nixos.org/nix/nix-[%latestNixVersion%]/install
<span class="shell-prompt">$</span> curl -o install-nix-[%latestNixVersion%].asc https://releases.nixos.org/nix/nix-[%latestNixVersion%]/install.asc
<span class="shell-prompt">$</span> gpg2 --recv-keys B541D55301270E0BCF15CA5D8170B4726D7198DE
<span class="shell-prompt">$</span> gpg2 --verify ./install-nix-[%latestNixVersion%].asc
<span class="shell-prompt">$</span> sh ./install-nix-[%latestNixVersion%]</pre>
<span class="shell-prompt">$ </span>curl -o install-nix-[%latestNixVersion%] https://releases.nixos.org/nix/nix-[%latestNixVersion%]/install
<span class="shell-prompt">$ </span>curl -o install-nix-[%latestNixVersion%].asc https://releases.nixos.org/nix/nix-[%latestNixVersion%]/install.asc
<span class="shell-prompt">$ </span>gpg2 --recv-keys B541D55301270E0BCF15CA5D8170B4726D7198DE
<span class="shell-prompt">$ </span>gpg2 --verify ./install-nix-[%latestNixVersion%].asc
<span class="shell-prompt">$ </span>sh ./install-nix-[%latestNixVersion%]</pre>
<p>
The <a href="[%root%]edolstra.gpg">signing key</a> has fingerprint
<code>B541 D553 0127 0E0B CF15 CA5D 8170 B472 6D71 98DE</code>.
Expand Down
32 changes: 16 additions & 16 deletions features.tt
Expand Up @@ -91,24 +91,24 @@
there after an upgrade. This means that you can <em>roll back</em> to
the old version:</p>

<pre class="code"><span class="shell-prompt">$</span> nix-env --upgrade <em>some-packages</em>
<span class="shell-prompt">$</span> nix-env --rollback
<pre class="code"><span class="shell-prompt">$ </span>nix-env --upgrade <em>some-packages</em>
<span class="shell-prompt">$ </span>nix-env --rollback
</pre>


<h3>Garbage collection</h3>

<p>When you uninstall a package like this…</p>

<pre class="code"><span class="shell-prompt">$</span> nix-env --uninstall firefox
<pre class="code"><span class="shell-prompt">$ </span>nix-env --uninstall firefox
</pre>

<p>the package isn’t deleted from the system right away (after all,
you might want to do a rollback, or it might be in the profiles of
other users). Instead, unused packages can be deleted safely by
running the <em>garbage collector</em>:</p>

<pre class="code"><span class="shell-prompt">$</span> nix-collect-garbage
<pre class="code"><span class="shell-prompt">$ </span>nix-collect-garbage
</pre>

<p>This deletes all packages that aren’t in use by any user profile or
Expand Down Expand Up @@ -137,7 +137,7 @@
<p>Nix expressions generally describe how to build a package from
source, so an installation action like</p>

<pre class="code"><span class="shell-prompt">$</span> nix-env --install firefox
<pre class="code"><span class="shell-prompt">$ </span>nix-env --install firefox
</pre>

<p><em>could</em> cause quite a bit of build activity, as not only
Expand Down Expand Up @@ -187,17 +187,17 @@ upgrades.</p>
href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/newsreaders/pan/default.nix">its
Nix expression</a>:</p>

<pre><span class="shell-prompt">$</span> nix-shell '&lt;nixpkgs&gt;' -A pan
<pre><span class="shell-prompt">$ </span>nix-shell '&lt;nixpkgs&gt;' -A pan
</pre>

<p>You’re then dropped into a shell where you can edit, build and test
the package:</p>

<pre><span class="shell-prompt">[nix-shell]$</span> tar xf $src
<span class="shell-prompt">[nix-shell]$</span> cd pan-*
<span class="shell-prompt">[nix-shell]$</span> ./configure
<span class="shell-prompt">[nix-shell]$</span> make
<span class="shell-prompt">[nix-shell]$</span> ./pan/gui/pan
<pre><span class="shell-prompt">[nix-shell]$ </span>tar xf $src
<span class="shell-prompt">[nix-shell]$ </span>cd pan-*
<span class="shell-prompt">[nix-shell]$ </span>./configure
<span class="shell-prompt">[nix-shell]$ </span>make
<span class="shell-prompt">[nix-shell]$ </span>./pan/gui/pan
</pre>

<p>Since Nix packages are reproducible and have complete dependency
Expand Down Expand Up @@ -270,7 +270,7 @@ upgrades.</p>
<p>After changing <tt>/etc/nixos/configuration.nix</tt>, you realise
the configuration by running this command:</p>

<pre class="code"><span class="shell-prompt">$</span> nixos-rebuild switch
<pre class="code"><span class="shell-prompt">$ </span>nixos-rebuild switch
</pre>

<p>This command does everything necessary to make the configuration
Expand Down Expand Up @@ -306,7 +306,7 @@ upgrades.</p>
instance, if after a <tt>nixos-rebuild switch</tt> you discover that
you don’t like the new configuration, you can just go back:</p>

<pre class="code"><span class="shell-prompt">$</span> nixos-rebuild switch --rollback
<pre class="code"><span class="shell-prompt">$ </span>nixos-rebuild switch --rollback
</pre>

<a href="/images/screenshots/nixos-grub.png"><img class="inline screenshot"
Expand Down Expand Up @@ -340,7 +340,7 @@ upgrades.</p>
as enabling a system service, or as large as rebuilding the entire
system with a new version of Glibc, you can test it by doing:</p>

<pre class="code"><span class="shell-prompt">$</span> nixos-rebuild test
<pre class="code"><span class="shell-prompt">$ </span>nixos-rebuild test
</pre>

<p>This builds and activates the new configuration, but doesn’t make
Expand All @@ -349,8 +349,8 @@ upgrades.</p>

<p>An even nicer way to test changes is the following:</p>

<pre class="code"><span class="shell-prompt">$</span> nixos-rebuild build-vm
<span class="shell-prompt">$</span> ./result/bin/run-*-vm
<pre class="code"><span class="shell-prompt">$ </span>nixos-rebuild build-vm
<span class="shell-prompt">$ </span>./result/bin/run-*-vm
</pre>

<p>This builds and starts a virtual machine that contains the new
Expand Down
30 changes: 15 additions & 15 deletions index.tt
Expand Up @@ -92,21 +92,21 @@
<h2>Try new tools without fear</h2>
<p>Don't clutter your system with tools that you use only now and then.</p>
<pre class="well">
<span class="shell-prompt">$</span> python --version
<span class="shell-prompt">$ </span>python --version
python: command not found
<span class="shell-prompt">$</span> <strong>nix-shell -p python3</strong>
<span class="shell-prompt">[nix-shell]$</span> python --version
<span class="shell-prompt">$ </span><strong>nix-shell -p python3</strong>
<span class="shell-prompt">[nix-shell]$ </span>python --version
Python 3.7.7</pre>

<h2>Multiple languages, one tool</h2>
<p></p>
<pre class="well">
<span class="shell-prompt">$</span> <strong>nix-shell -p python3 nodejs go rustc</strong>
<span class="shell-prompt">[nix-shell]$</span> node --version
<span class="shell-prompt">$ </span><strong>nix-shell -p python3 nodejs go rustc</strong>
<span class="shell-prompt">[nix-shell]$ </span>node --version
v10.20.1
<span class="shell-prompt">[nix-shell]$</span> go version
<span class="shell-prompt">[nix-shell]$ </span>go version
go version go1.14.1 linux/amd64
<span class="shell-prompt">[nix-shell]$</span> rustc --version
<span class="shell-prompt">[nix-shell]$ </span>rustc --version
rustc 1.42.0</pre>

</div>
Expand All @@ -133,10 +133,10 @@ pkgs.mkShell {
}</pre>
<p>Then enter development environment with:</p>
<pre class="well">
<span class="shell-prompt">$</span> <strong>nix-shell</strong>
<span class="shell-prompt">[nix-shell]$</span> virtualenv --version
<span class="shell-prompt">$ </span><strong>nix-shell</strong>
<span class="shell-prompt">[nix-shell]$ </span>virtualenv --version
16.7.9
<span class="shell-prompt">[nix-shell]$</span> yarn --version
<span class="shell-prompt">[nix-shell]$ </span>yarn --version
1.22.4</pre>
<p>
Commit the above <code>shell.nix</code> file and let you coworkers have
Expand Down Expand Up @@ -184,17 +184,17 @@ pkgs.dockerTools.buildLayeredImage {
}</pre>
<p>To build and run the image you need to:</p>
<pre class="well">
<span class="shell-prompt">$</span> <strong>nix-build default.nix -o ./result</strong>
<span class="shell-prompt">$ </span><strong>nix-build default.nix -o ./result</strong>
...
/nix/store/&#8230;-docker-image-only-hello.tar.gz
<span class="shell-prompt">$</span> docker load -i ./result
<span class="shell-prompt">$ </span>docker load -i ./result
1c31fbac2eb1: Loading layer [==================>] 1.649MB/1.649MB
03b22f688054: Loading layer [==================>] 256kB/256kB
29c350a9c392: Loading layer [==================>] 31.61MB/31.61MB
6a87e4d71e07: Loading layer [==================>] 266.2kB/266.2kB
c09c43a6b910: Loading layer [==================>] 71.68kB/71.68kB
Loaded image: only-hello:qn5x1pnk7d467jsl81jng7168qsks42l
<span class="shell-prompt">$</span> docker run only-hello:qn5x1pnk7d467jsl81jng7168qsks42l hello"
<span class="shell-prompt">$ </span>docker run only-hello:qn5x1pnk7d467jsl81jng7168qsks42l hello"
Hello, world</pre>
<p>
Learn more <a href="[%root%]nixpkgs/manual/#sec-pkgs-dockerTools">how
Expand Down Expand Up @@ -231,12 +231,12 @@ Hello, world</pre>
}</pre>
<p>Now we just need to build it.</p>
<pre class="well">
<span class="shell-prompt">$</span> <strong>nix-build '&lt;nixpkgs/nixos/release.nix&gt;' \</strong>
<span class="shell-prompt">$ </span><strong>nix-build '&lt;nixpkgs/nixos/release.nix&gt;' \</strong>
<strong> -A amazonImage.x86_64-linux \</strong>
<strong> --arg configuration ./amazon.nix \</strong>
<strong> -o ./result</strong>
...
<span class="shell-prompt">$</span> ls ./result/
<span class="shell-prompt">$ </span>ls ./result/
nixos-amazon-image-20.09pre130979.gfedcba-x86_64-linux.vhd
nix-support</pre>
<p>
Expand Down

0 comments on commit 0f2285f

Please sign in to comment.