mirror of
https://codeberg.org/mhwombat/nix-book.git
synced 2026-05-14 05:41:12 +08:00
initial commit
This commit is contained in:
parent
7e29b45472
commit
123e584cb5
3 changed files with 61 additions and 0 deletions
34
source/recipes/devshell/non-flake/main.adoc0
Normal file
34
source/recipes/devshell/non-flake/main.adoc0
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
= A non-flake package (not in nixpkgs)
|
||||
|
||||
////
|
||||
$ mkdir tempwork
|
||||
$ cd tempwork
|
||||
$ cp ../flake.nix flake.nix
|
||||
$ git add flake.nix
|
||||
$ nix develop
|
||||
$ git add flake.lock
|
||||
$ git commit -a -m temp
|
||||
////
|
||||
|
||||
In this example, we will use a nix package defined in a remote git repo.
|
||||
However, you can use any of the flake reference styles defined in <<#flakeref>>.
|
||||
|
||||
[source,nix,linenums,highlight='5..7,17..20']
|
||||
.flake.nix
|
||||
....
|
||||
$# cat flake.nix
|
||||
....
|
||||
|
||||
Here's a demonstration using the shell.
|
||||
|
||||
....
|
||||
$ hello-nix # this will fail
|
||||
$# ../../../../../start-shell nix develop <<EOL
|
||||
$ hello-nix
|
||||
$# EOL
|
||||
....
|
||||
|
||||
////
|
||||
Good adoc0 scripts clean up after themselves.
|
||||
$ cd .. ; rm -rf tempwork # clean up
|
||||
////
|
||||
15
source/recipes/shebang/flake/main.adoc0
Normal file
15
source/recipes/shebang/flake/main.adoc0
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
= Access a flake
|
||||
|
||||
In this example, we will use a flake defined in a remote git repo.
|
||||
However, you can use any of the flake reference styles defined in <<#flakeref>>.
|
||||
|
||||
[source,bash,linenums,highlight=1..2]
|
||||
.Script
|
||||
....
|
||||
$# cat run-flake.sh
|
||||
....
|
||||
|
||||
.Output
|
||||
....
|
||||
$# ./run-flake.sh
|
||||
....
|
||||
12
source/recipes/shebang/nixpkg/main.adoc0
Normal file
12
source/recipes/shebang/nixpkg/main.adoc0
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
= Access a top level package from the Nixpkgs/NixOS repo
|
||||
|
||||
[source,bash,linenums,highlight=1..2]
|
||||
.Script
|
||||
....
|
||||
$# cat run-nixpkg.sh
|
||||
....
|
||||
|
||||
.Output
|
||||
....
|
||||
$# ./run-nixpkg.sh
|
||||
....
|
||||
Loading…
Add table
Add a link
Reference in a new issue