$ which hello-flake -/nix/store/qskl8ajlgnl654fhgsmv74yv8x9r3kzg-hello-flake/bin/hello-flake+/nix/store/y0i81pxnbrg8jpvqp886b4lrzh7wb0ni-hello-flake/bin/hello-flake
diff --git a/index.html b/index.html index 5d66de8..2556cd8 100644 --- a/index.html +++ b/index.html @@ -1900,7 +1900,7 @@ location of the executable, if we’re curious.
$ which hello-flake -/nix/store/qskl8ajlgnl654fhgsmv74yv8x9r3kzg-hello-flake/bin/hello-flake+/nix/store/y0i81pxnbrg8jpvqp886b4lrzh7wb0ni-hello-flake/bin/hello-flake
$ exit -$ hello-flake # Won't work outside development shell +$ hello-flake # Fails outside development shell bash: line 24: hello-flake: command not found
$ /nix/store/qskl8ajlgnl654fhgsmv74yv8x9r3kzg-hello-flake/bin/hello-flake +$ /nix/store/y0i81pxnbrg8jpvqp886b4lrzh7wb0ni-hello-flake/bin/hello-flake Hello from your flake!
hello-flake file.
$ ./hello-flake # Won't work +$ ./hello-flake # Fails ./hello-flake: line 3: cowsay: command not found
$ nix run # Won't work +$ nix run # Fails warning: Git tree '/home/amy/codeberg/nix-book/source/modify-hello-flake/hello-flake' is dirty /nix/store/rnjqkk7a8sz6wrm1qb1hxssy7qlgaa85-hello-flake/bin/hello-flake: line 3: cowsay: command not found
git push the changes until we’re ready to
$ git commit hello-flake flake.nix -m 'added bovine feature' -[main a10700e] added bovine feature +[main cb77c4d] added bovine feature 2 files changed, 13 insertions(+), 1 deletion(-) $ nix run ________________________ @@ -3381,7 +3381,7 @@ You can come back to this section later to learn more.@@ -4272,7 +4280,7 @@ We need to add this to the repo, and commit all important files.$ nix shell nixpkgs#ghc -$ runghc Main.hs # Won't work +$ runghc Main.hs # Fails Main.hs:1:1: error: [GHC-87110] Could not find module ‘Network.HostName’. @@ -3400,7 +3400,7 @@ Let’s exit that shell and try again, this time adding thehostname@@ -3788,6 +3788,11 @@ The important thing for now is that the build succeeded.$ exit $ nix shell nixpkgs#ghc nixpkgs#hostname -$ runghc Main.hs # Won't work +$ runghc Main.hs # Fails Main.hs:1:1: error: [GHC-87110] Could not find module ‘Network.HostName’. @@ -3423,7 +3423,7 @@ The package we want is in the package set calledhaskellPackages<$ exit $ nix shell nixpkgs#ghc nixpkgs#haskellPackages.hostname -$ runghc Main.hs # Won't work +$ runghc Main.hs # Fails Main.hs:1:1: error: [GHC-87110] Could not find module ‘Network.HostName’. @@ -3770,7 +3770,7 @@ warning: creating lock file '"/home/amy/codeberg/nix-book/source/new-flake/haske • Added input 'haskell-flake': 'github:srid/haskell-flake/2acbf1c9bb7aac38b59dcc3c1bd78911cf37e42c?narHash=sha256-jwZT6Ns4BXlrFHaXjZgZwfhSaw8nTCTKZ8fCDylrONM%3D' (2025-09-14) • Added input 'nixpkgs': - 'github:nixos/nixpkgs/6d7ec06d6868ac6d94c371458fc2391ded9ff13d?narHash=sha256-fEvTiU4s9lWgW7mYEU/1QUPirgkn%2BodUBTaindgiziY%3D' (2025-09-13) + 'github:nixos/nixpkgs/88cef159e47c0dc56f151593e044453a39a6e547?narHash=sha256-kYhNxLlYyJcUouNRazBufVfBInMWMyF%2B44xG/xar2yE%3D' (2025-09-14) warning: Git tree '/home/amy/codeberg/nix-book/source/new-flake/haskell-flake/hello-haskell' is dirty@@ -3807,7 +3812,7 @@ We need to add this to the repo, and commit all important files.$ nix run warning: Git tree '/home/amy/codeberg/nix-book/source/new-flake/haskell-flake/hello-haskell' is dirty +these 2 derivations will be built: + /nix/store/b67dd3m503q30yiwfgav3xzz88bb91h4-hello-flake-haskell-source-1.0.0.drv + /nix/store/bgjyjh7282728b2qff37ldygg80zk4m1-hello-flake-haskell-1.0.0.drv +building '/nix/store/b67dd3m503q30yiwfgav3xzz88bb91h4-hello-flake-haskell-source-1.0.0.drv'... +building '/nix/store/bgjyjh7282728b2qff37ldygg80zk4m1-hello-flake-haskell-1.0.0.drv'... Hello from Haskell inside a Nix flake! Your hostname is: wombat11k$ git add flake.lock $ git commit -a -m 'initial commit' -[master (root-commit) d35f8fd] initial commit +[master (root-commit) c64c57a] initial commit 5 files changed, 170 insertions(+) create mode 100644 LICENSE create mode 100644 Main.hs @@ -4009,7 +4014,7 @@ First we’ll try building the package manually.@@ -4212,7 +4217,7 @@ something like this.-$ python -m build # Won't work +$ python -m build # Fails /nix/store/iyff8129iampdw13nlfqalzhxy8y1hi9-python3-3.13.6/bin/python: No module named build@@ -4254,6 +4259,9 @@ The important thing for now is that the build succeeded.-$ nix build # Won't work +$ nix build # Fails error: Path 'flake.nix' in the repository "/home/amy/codeberg/nix-book/source/new-flake/python-flake/hello-python" is not tracked by Git. To make it visible to Nix, run: @@ -4236,7 +4241,7 @@ warning: creating lock file '"/home/amy/codeberg/nix-book/source/new-flake/pytho • Added input 'flake-utils/systems': 'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e?narHash=sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768%3D' (2023-04-09) • Added input 'nixpkgs': - 'github:NixOS/nixpkgs/5ad881b15fb2b63c2f127533ca59f840fcc24c3f?narHash=sha256-P8XdKg87fR5PpCjIgMH%2B05PDwhdmlNrigsvChdHfyaw%3D' (2025-09-14) + 'github:NixOS/nixpkgs/dd16e0b60390586a261a4e28fc180a91212fe010?narHash=sha256-yM1FFsRiyESij/lzbdBMCUoFOKMoShHu0CAexnBWzTM%3D' (2025-09-15) warning: Git tree '/home/amy/codeberg/nix-book/source/new-flake/python-flake/hello-python' is dirty$ nix run warning: Git tree '/home/amy/codeberg/nix-book/source/new-flake/python-flake/hello-python' is dirty +this derivation will be built: + /nix/store/kr0aywqsm9v8ds4mc909iaan2yaqmjq3-hello-flake-python.drv +building '/nix/store/kr0aywqsm9v8ds4mc909iaan2yaqmjq3-hello-flake-python.drv'... Hello from inside a Python program built with a Nix flake!$ git add flake.lock $ git commit -a -m 'initial commit' -[master (root-commit) 2af9bd5] initial commit +[master (root-commit) deac9ed] initial commit 4 files changed, 127 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix @@ -4655,7 +4663,7 @@ sanitized: <strong>some text</strong>-$ cowsay "Moo!" # Won't work; dependency not available +$ cowsay "Moo!" # Fails; dependency not available bash: line 17: cowsay: command not found $ nix develop $ cowsay "Moo!" # Works in development environment @@ -4780,7 +4788,7 @@ we see that this flake provides both a package and an app calledhello@@ -5461,7 +5474,7 @@ Hello from your flake!-$ hello-flake # Won't work; dependency not available +$ hello-flake # Fails; dependency not available bash: line 40: hello-flake: command not found $ nix develop $ hello-flake # Works in development environment @@ -4885,18 +4893,23 @@ together with the high-level workflow described in-$ runghc Main.hs # Won't work; dependency not available +$ runghc Main.hs # Fails; dependency not available Main.hs:1:1: error: [GHC-87110] - Could not find module ‘Data.List.Extra’. + Could not find module ‘Text.Pandoc.Filters.Columns’. Use :set -v to see a list of the files searched for. | -1 | import Data.List.Extra - | ^^^^^^^^^^^^^^^^^^^^^^ +1 | import Text.Pandoc.Filters.Columns + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ $ nix develop $ runghc Main.hs # Works in development environemnt -"abcde" -"XYZ"+ +Main.hs:1:1: error: [GHC-87110] + Could not find module ‘Text.Pandoc.Filters.Columns’. + Use :set -v to see a list of the files searched for. + | +1 | import Text.Pandoc.Filters.Columns + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^