about summary refs log tree commit diff
path: root/pkgs/development/compilers/microscheme
diff options
context:
space:
mode:
authorAntoine R. Dumont <antoine.romain.dumont@gmail.com>2015-02-15 00:32:34 +0100
committerBjørn Forsman <bjorn.forsman@gmail.com>2015-02-16 23:09:48 +0100
commit172d78923b8213af39ceb0198d6766d2fc311120 (patch)
tree7442943da5d1703470aaa41c4c065d2675fc8bbf /pkgs/development/compilers/microscheme
parent9b81fa284faa531f3b7bc90dba8926a604c7d143 (diff)
Add microscheme derivation
(A Scheme subset for Atmel microcontrollers.)

Use of the actual git HEAD because the actual tarball compiles but
segfault at runtime.

Upload the BLINK.ms sample on arduino board (/dev/ttyACM0):

```sh
$ sudo ./result/bin/microscheme -m UNO -d /dev/ttyACM0 -auc ~/repo/perso/microscheme/examples/BLINK.ms
Microscheme 0.8, (C) Ryan Suchocki
>> Treeshaker: After 4 rounds: 84 globals purged! 22 bytes will be
reserved.
>> 18 lines compiled OK
>> Assembling...
>> Uploading...

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100%
0.00s

avrdude: Device signature = 0x1e950f
avrdude: reading input file
"/home/tony/repo/perso/microscheme/examples/BLINK.hex"
avrdude: writing flash (2080 bytes):

Writing | ################################################## | 100%
0.35s

avrdude: 2080 bytes of flash written

avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done.  Thank you.

>> Cleaning Up...
>> Finished.
```
Diffstat (limited to 'pkgs/development/compilers/microscheme')
-rw-r--r--pkgs/development/compilers/microscheme/default.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/development/compilers/microscheme/default.nix b/pkgs/development/compilers/microscheme/default.nix
new file mode 100644
index 0000000000000..a9f2fba9409f8
--- /dev/null
+++ b/pkgs/development/compilers/microscheme/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchgit, vim, avrdude, avrgcclibc, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "microscheme-${version}";
+  version = "2015-02-04";
+
+  # externalize url/rev/sha256 to permit easier override
+  rev = "2f14781034a67adc081a22728fbf47a632f4484e";
+  sha256 = "15bdlmchzbhxj262r2fj78wm4c4hfrap4kyzv8n5b624svszr0zd";
+  url = https://github.com/ryansuchocki/microscheme.git;
+
+  src = fetchgit {
+    inherit rev;
+    inherit sha256;
+    inherit url;
+  };
+
+  buildInputs = [ makeWrapper vim ];
+
+  installPhase = ''
+    mkdir -p $out/bin && make install PREFIX=$out
+
+    mkdir -p $out/share/microscheme/
+    cp -r examples/ $out/share/microscheme
+
+    wrapProgram $out/bin/microscheme \
+      --prefix PATH : "${avrdude}/bin:${avrgcclibc}/bin"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://microscheme.org;
+    description = "A Scheme subset for Atmel microcontrollers";
+    longDescription = ''
+      Microscheme is a Scheme subset/variant designed for Atmel
+      microcontrollers, especially as found on Arduino boards.
+    '';
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ ardumont ];
+  };
+}