summaryrefslogtreecommitdiffstats
path: root/examples/hello_world.nix
blob: 4f9330a9d1ca6cc9a0a03f20554533d827572189 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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/"}
  '';
}