aboutsummaryrefslogtreecommitdiffstats
path: root/examples/hello_world.nix
diff options
context:
space:
mode:
authorlassulus <lass@blue.r>2018-09-11 20:07:04 +0200
committerlassulus <lass@blue.r>2018-09-11 20:07:04 +0200
commit368a04fec30837037079d13c3704b9766af37eb8 (patch)
treebf194984a5c45708d8f97e83fa8c8db824533d46 /examples/hello_world.nix
parentf765bef6beb3c9a7275d5171e6c9029b4f7a494e (diff)
add examples
Diffstat (limited to 'examples/hello_world.nix')
-rw-r--r--examples/hello_world.nix30
1 files changed, 30 insertions, 0 deletions
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 <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"
+ '';
+ 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/"}
+ '';
+}