mirror of
https://codeberg.org/mhwombat/nix-book.git
synced 2026-02-04 03:53:39 +08:00
restructured repo
This commit is contained in:
parent
bea4055fc9
commit
285f60104b
22 changed files with 167 additions and 313 deletions
|
|
@ -1,3 +0,0 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p cowsay
|
||||
cowsay "Pretty cool, huh?"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
== Nix-shell shebangs
|
||||
= Nix-shell shebangs
|
||||
|
||||
You can use `nix-shell` to run scripts in arbitrary languages, providing
|
||||
the necessary dependencies. This is particularly convenient for
|
||||
|
|
@ -9,32 +9,6 @@ The script should start with two "`shebang`" (`#!`) commands. The first
|
|||
should invoke `nix-shell`. The second should declares the scrpt
|
||||
interpreter and any dependencies. Here are some examples.
|
||||
|
||||
=== A Bash script depending on a package in the nixpkgs repo.
|
||||
include::bash-with-nix-pkg/main-generated.adoc[leveloffset=+1]
|
||||
|
||||
Script:
|
||||
|
||||
[source,bash,linenums]
|
||||
....
|
||||
include::bash-with-nixpkg.sh[]
|
||||
....
|
||||
|
||||
Output:
|
||||
|
||||
....
|
||||
$# ./bash-with-nixpkg.sh
|
||||
....
|
||||
|
||||
=== A Python script depending on a package in the nixpkgs repo.
|
||||
|
||||
Script:
|
||||
|
||||
[source,bash,linenums]
|
||||
....
|
||||
include::python-with-nixpkg.sh[]
|
||||
....
|
||||
|
||||
Output:
|
||||
|
||||
....
|
||||
$# ./python-with-nixpkg.sh
|
||||
....
|
||||
include::python-with-nix-pkg/main-generated.adoc[leveloffset=+1]
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i python3 -p python3Packages.html-sanitizer
|
||||
|
||||
from html_sanitizer import Sanitizer
|
||||
sanitizer = Sanitizer() # default configuration
|
||||
|
||||
original='<span style="font-weight:bold">some text</span>'
|
||||
print('original: ', original)
|
||||
|
||||
sanitized=sanitizer.sanitize(original)
|
||||
print('sanitized: ', sanitized)
|
||||
Loading…
Add table
Add a link
Reference in a new issue