From 368a04fec30837037079d13c3704b9766af37eb8 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 11 Sep 2018 20:07:04 +0200 Subject: add examples --- examples/hello_world.nix | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 examples/hello_world.nix (limited to 'examples/hello_world.nix') diff --git a/examples/hello_world.nix b/examples/hello_world.nix new file mode 100644 index 0000000..4bb3db1 --- /dev/null +++ b/examples/hello_world.nix @@ -0,0 +1,30 @@ +let + pkgs = import { overlays = [ (import ../pkgs) ]; }; +in { + bash = pkgs.writeBash "hello-world" '' + echo 'hello world' + ''; + c = pkgs.writeC "hello-world" {} '' + #include + int main() { + printf("hello world\n"); + return 0; + } + ''; + dash = pkgs.writeDash "hello-world" '' + echo 'hello world' + ''; + haskell = pkgs.writeHaskell "hello-world" [] '' + main = do + putStrLn "hello world" + ''; + python2 = pkgs.writePython2 "hello-world" {} '' + print "hello world" + ''; + python3 = pkgs.writePython3 "hello-world" {} '' + print("hello world") + ''; + sed = pkgs.writeDash "sed-example" '' + echo xxx | ${pkgs.writeSed "hello-world" "s/xxx/hello world/"} + ''; +} -- cgit v1.2.3