mirror of
https://codeberg.org/mhwombat/nix-book.git
synced 2025-12-28 01:05:02 +08:00
31 lines
575 B
Text
31 lines
575 B
Text
= Access a top level package from the Nixpkgs/NixOS repo
|
|
|
|
////
|
|
$ mkdir tempwork
|
|
$ cd tempwork
|
|
$ cp ../flake.nix flake.nix
|
|
$ git add flake.nix
|
|
$ nix develop
|
|
$ git add flake.lock
|
|
$ git commit -a -m temp
|
|
////
|
|
|
|
[source,nix,linenums,highlight=15]
|
|
.flake.nix
|
|
....
|
|
$# cat flake.nix
|
|
....
|
|
|
|
Here's a demonstration using the shell.
|
|
|
|
....
|
|
$ cowsay "Moo!" # Fails; dependency not available
|
|
$# start-shell nix develop <<EOL
|
|
$ cowsay "Moo!" # Works in development environment
|
|
$# EOL
|
|
....
|
|
|
|
////
|
|
Good adoc0 scripts clean up after themselves.
|
|
$ cd .. ; rm -rf tempwork # clean up
|
|
////
|