aboutsummaryrefslogtreecommitdiffstats
path: root/examples/simple.nix
diff options
context:
space:
mode:
Diffstat (limited to 'examples/simple.nix')
-rw-r--r--examples/simple.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/simple.nix b/examples/simple.nix
new file mode 100644
index 0000000..32a4cee
--- /dev/null
+++ b/examples/simple.nix
@@ -0,0 +1,38 @@
+let
+ pkgs = import <nixpkgs> { overlays = [ (import ../pkgs) ]; };
+in {
+ bash = pkgs.writeBash "hello-world" ''
+ if [[ "test" == "test" ]]; then echo "bash features"; fi
+ '';
+ # cc -L/nix/store/...blah/lib -I/nix/store/...blah/include
+ dash = pkgs.writeDash "hello-world" ''
+ test '~' = '~' && echo 'dash features'
+ '';
+ haskell = pkgs.writeHaskell "hello-world" [ "acme-cuteboy" ] ''
+ import Acme.CuteBoy
+
+ main :: IO ()
+ main = print Rolf
+ '';
+ python2 = pkgs.writePython2 "hello-world" { deps = [ pkgs.python2Packages.pyyaml ]; } ''
+ import yaml
+
+ print yaml.load("""
+ - some
+ - random
+ - variables
+ """)
+ '';
+ python3 = pkgs.writePython3 "hello-world" { deps = [ pkgs.python3Packages.pyyaml ]; } ''
+ import yaml
+
+ print(yaml.load("""
+ - some
+ - random
+ - variables
+ """))
+ '';
+ sed = pkgs.writeDash "sed-example" ''
+ echo hello | ${pkgs.writeSed "hello-world" "s/hello/& world/"}
+ '';
+}