aboutsummaryrefslogtreecommitdiffstats
path: root/examples/hello_world.nix
blob: 4944c13c5bab606d4862109b58e4ded081e31348 (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
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"
  '';
  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/"}
  '';
}