[Nix-dev] How to develop with chicken and emacs
Moritz Ulrich
moritz at tarn-vedra.de
Tue Apr 21 14:21:10 CEST 2015
Eike <eike at eknet.org> writes:
> Hi,
>
> I'm about to learn scheme and installed chicken for this. I'm now trying
> to install some chicken eggs. The command `chicken-install` does not
> work out of the box, since it tries to install the packages into the nix
> store.
>
> I found out about the egg2nix program and saw, that the
> 'chicken-eggs.nix' file contains many eggs and that the egg2nix program
> uses it. So, right now I'm starting a shell like this
>
> nix-shell -p egg2nix
>
> This drops me in a shell, where the eggs are setup via
> CHICKEN_REPOSITORY_EXTRA and CHICKEN_INCLUDE_PATH. That's a step
> forward, but it still feels strange. Maybe just because I'm not used to
> it… Is this a recommended way for developing? (I probably should create
> my own nix file to make this env I guess)
>
> But the real problem is, that my emacs doesn't know about this
> environment. I don't know how to handle this (besides starting a
> new emacs from the nix-shell shell, which I don't want).
>
> Can someone share the setup he or she is using with chicken and nixos or
> give me some hints/links to this?
>
> Thanks and regards
> Eike
>
> --
> gpg: AD7AC35E
> finger print: 137F BB0B 1639 D25F DC5D E59C B412 C5F5 AD7A C35E
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
Failed at reply-all - sorry for the complications:
egg2nix author here.
We're actually planning to ship all eggs readily available in nixpkgs
(like haskellPackages or emacsPackages) We're just not fully there yet.
egg2nix is exactly the tool you want. You give it a list of eggs and it
will generate nix-expressions for these eggs and all dependencies.
The usual way of developing a chicken project on NixOS right now is to
get a list of eggs, put it in a file with one egg per line, then run
egg2nix on the file like this:
egg2nix -v input.scm > eggs.nix
This will fetch all eggs, do some things with them and output
nix-expressions for the eggs to eggs.nix.
You can then use the generated nix-expressions from eggs.nix in a
derivation to build your project. One example is found in egg2nix
itself:
{ nixpkgs ? <nixpkgs> }:
let
pkgs = import nixpkgs {};
stdenv = pkgs.stdenv;
eggs = import ./eggs.nix { inherit pkgs stdenv; };
in
pkgs.eggDerivation {
src = ./.;
name = "egg2nix-0.4";
buildInputs = with eggs; [
matchable http-client args
];
}
This saved to default.nix next to eggs.nix will enable you to run
`nix-shell' in the current directory and get a shell with all eggs you
listed in input.scm.
From there you can use `csi' and all the other tools provided by chicken
(except chicken-install, as you found out).
As for emacs integration: Once you got it to this state you can just set
`scheme-program-name' to something like:
nix-shell default.nix --command csi
`M-x run-scheme' in Emacs then starts a shell in the current directory
using default.nix and directly runs the `csi' command, dropping you into
a Chicken REPL.
I'm sorry for the missing documentation regarding egg2nix - we included
it in nixpkgs out of personal need and never really got around writing
some good documentation on it. I'll try to fix this as soon as possible.
Let me know if you have any other questions.
Cheers
Moritz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150421/5e3e3091/attachment.bin
More information about the nix-dev
mailing list