aboutsummaryrefslogtreecommitdiffstats
path: root/examples/hello_world.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2018-09-25 20:38:14 +0200
committertv <tv@krebsco.de>2018-09-25 20:38:14 +0200
commit0660cc1a1169e799bda356c6fadb245a96345816 (patch)
tree74e5443bd152333b50c2d5619926eb31b69513ec /examples/hello_world.nix
parentc27a9416e8ee04d708b11b48f8cf1a055c0cc079 (diff)
parent79ab2c27f9d7903ff3ed9bcd8de493b1191bbc12 (diff)
Merge remote-tracking branch 'lass/master'v3.1.0ni/master
Diffstat (limited to 'examples/hello_world.nix')
-rw-r--r--examples/hello_world.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/examples/hello_world.nix b/examples/hello_world.nix
new file mode 100644
index 0000000..4f9330a
--- /dev/null
+++ b/examples/hello_world.nix
@@ -0,0 +1,36 @@
+let
+ pkgs = import <nixpkgs> { overlays = [ (import ../pkgs) ]; };
+in {
+ bash = pkgs.writeBash "hello-world" ''
+ echo 'hello world'
+ '';
+ c = pkgs.writeC "hello-world" {} ''
+ #include <stdio.h>
+ 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"
+ '';
+ js = pkgs.writeJS "hello-world" {} ''
+ console.log("hello world")
+ '';
+ perl = pkgs.writePerl "hello-world" {} ''
+ print "hello world\n";
+ '';
+ 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/"}
+ '';
+}