Skip to content

nix-hackers/nix-shell-workshop

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nix-shell workshop

C++ — custom library

Package a custom library mylib and use it in a program main.

Check out mylib.nix and default.nix to see how it's done.

  • Enter the environment:

    cd cpp
    nix-shell
  • Build and install mylib:

    make -C mylib all install prefix=/usr/local

    Adjust prefix as necessary.

  • Change the working directory to main and build it:

    cd main
    make
  • Run the example to see the ultimate answer:

    $ ./main
    hello world from the #cccamp2015, the answer is
    42
    

Go — minimal webserver

Serve a "Hello World" HTML page on port 8080.

  • Enter the environment:

    cd go
    nix-shell
  • Run the example:

    hello-go

Perl — WWW::Curl::Easy script

Download Perl 5.18.2 via WWW::Curl::Easy.

  • Enter the environment:

    cd perl
    nix-shell -p perl perlPackages.WWWCurl
  • Run the example:

    ./www_curl_easy.pl

Python — curl-like script

  • Enter environment:

    cd python
    nix-shell
  • Run the example to print the HTML of http://test.de:

    python simpleCurl.py http://test.de

Rust — Hello, world!

  • Enter the environment:

    cd rust
    nix-shell
  • Run the example to print Hello, world!:

    $ hello-rust
    Hello, world!
    

Documentation

License

Public Domain Mark
This work (nix-shell workshop, by Joachim Schiele, seitz, Justin Humm, Lassulus, Markus Kohlhase, Alexander Flatter), identified by Eric Bailey, is free of known copyright restrictions.

About

nix-shell examples

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nix 54.9%
  • Perl 21.3%
  • C++ 8.0%
  • Makefile 5.5%
  • Go 4.7%
  • QMake 2.7%
  • Other 2.9%