mirror of
https://codeberg.org/mhwombat/nix-book.git
synced 2026-05-14 05:31:12 +08:00
temp
This commit is contained in:
parent
a23029eb15
commit
00bfdf2c0f
12 changed files with 161 additions and 140 deletions
|
|
@ -70,7 +70,7 @@ Let's enter a shell with the Glasgow Haskell Compiler ("ghc") and try to run the
|
|||
....
|
||||
$# echo '$ nix shell nixpkgs#ghc'
|
||||
$# nix shell nixpkgs#ghc --command sh
|
||||
$ runghc Main.hs
|
||||
$ runghc Main.hs # Won't work
|
||||
....
|
||||
|
||||
The error message tells us that we need the module `Network.HostName`.
|
||||
|
|
@ -81,7 +81,7 @@ Let's exit that shell and try again, this time adding the `hostname` package.
|
|||
$# echo '$ exit'
|
||||
$# echo '$ nix shell nixpkgs#ghc nixpkgs#hostname'
|
||||
$# nix shell nixpkgs#ghc nixpkgs#hostname --command sh
|
||||
$ runghc Main.hs
|
||||
$ runghc Main.hs # Won't work
|
||||
....
|
||||
|
||||
That reason that failed is that we asked for the wrong package.
|
||||
|
|
@ -95,7 +95,7 @@ Let's try that again, with the correct package.
|
|||
$# echo '$ exit'
|
||||
$# echo '$ nix shell nixpkgs#ghc nixpkgs#haskellPackages.hostname'
|
||||
$# nix shell nixpkgs#ghc nixpkgs#haskellPackages.hostname --command sh
|
||||
$ runghc Main.hs
|
||||
$ runghc Main.hs # Won't work
|
||||
....
|
||||
|
||||
Now what's wrong?
|
||||
|
|
@ -121,10 +121,6 @@ $ runghc Main.hs
|
|||
|
||||
Success! Now we know the program works.
|
||||
|
||||
....
|
||||
$# echo '$ exit'
|
||||
....
|
||||
|
||||
== The cabal file
|
||||
|
||||
It's time to write a Cabal file for this program.
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ We won't write `flake.nix` just yet.
|
|||
First we'll try building the package manually.
|
||||
(If you didn't run the `nix shell` command from <<python-nix-shell,earlier>>, do so now.)
|
||||
....
|
||||
$ python -m build
|
||||
$ python -m build # Won't work
|
||||
....
|
||||
|
||||
The missing module error happens because we don't have `build` available
|
||||
|
|
@ -198,11 +198,11 @@ $# cat flake.nix
|
|||
Let's try out the new flake.
|
||||
|
||||
....
|
||||
$ nix build
|
||||
$ nix build # Won't work
|
||||
....
|
||||
|
||||
Why can't it find `flake.nix`? Nix flakes only "`see`" files that are
|
||||
part of the repository. We need to add all of the important files to the
|
||||
Nix flakes only "`see`" files that are part of the repository.
|
||||
We need to add all of the important files to the
|
||||
repo before building or running the flake.
|
||||
|
||||
....
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue