aboutsummaryrefslogtreecommitdiffstats
path: root/examples/hello_world.nix
blob: f71804f58258596785e8c2a58956f9b5af4bafe9 (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"
  '';
  js = pkgs.writeJS "hello-world" {} ''
    console.log("hello world")
  '';
  perl = pkgs.writePerl "hello-world" {} ''
    print "hello world\n";
  '';
  python3 = pkgs.writePython3 "hello-world" {} ''
    print("hello world")
  '';
  sed = pkgs.writeDash "sed-example" ''
    echo xxx | ${pkgs.writeSed "hello-world" "s/xxx/hello world/"}
  '';
}