Skip to content

Commit c818826

Browse files
committed
add python tutorial for nix-shell
1 parent 74e1e9e commit c818826

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
# nix-shell workshop
1+
# nix-shell workshop
22

33
## normal c programs
44
## go programs
55
## qt programs
66
## perl
77
## python
8+
enter environment by typing `nix-shell` in ./python-program
9+
run simpleCurl by running `python simpleCurl http://test.de`
10+
it will output the html of http://test.de

python-program/default.nix

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
let
2+
pkgs = import <nixpkgs> {};
3+
stdenv = pkgs.stdenv;
4+
5+
in stdenv.mkDerivation {
6+
name = "simpleCurl-env";
7+
8+
buildInputs = with pkgs; [
9+
python2
10+
python2Packages.mechanize
11+
];
12+
}

python-program/simpleCurl.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import mechanize
2+
import sys
3+
4+
br = mechanize.Browser()
5+
r = br.open(sys.argv[1])
6+
print r.read()

0 commit comments

Comments
 (0)