shell.nix pasted by DerGuteMoritz on Sat Apr 10 00:33:16 2021

# This allows you to run csi and (import matchable)
# However, chickenEggs is a pretty limited set of eggs.
# You can use egg2nix to generate an eggs.nix with whichever other eggs you desire (see e.g. nixpkgs/pkgs/tools/backup/ugarit)

{
  pkgs ? import <nixpkgs> { }
}:
pkgs.mkShell {
  buildInputs = with pkgs.chickenPackages; [
    chicken
    chickenEggs.matchable
  ];
}

An example of shell.nix with a custom set of eggs (sans foreign deps so far) pasted by DerGuteMoritz on Sun Apr 11 15:06:52 2021

;; shell.nix
{
  pkgs ? import <nixpkgs> { }
}:
let
  # This version of egg2nix includes a few fixes for C5 egg file compat.
  # See https://github.com/DerGuteMoritz/egg2nix/commits/chicken-5
  # Also, the egg2nix version available via nixpkgs was lagging a bit
  # behind upstream, see https://github.com/NixOS/nixpkgs/pull/119085
  egg2nix = pkgs.chickenPackages_5.egg2nix.overrideAttrs (_: {
    src = pkgs.fetchFromGitHub {
      owner = "DerGuteMoritz";
      repo = "egg2nix";
      rev = "7a42985b2eff7d120be2cec65493ad52084b4e44";
      sha256 = "1pzfmw6wlr0rlg167rdzr5w1x2pg4g5nszajwr1m6ra6k4pcksc1";
    };
  });
  eggs = import ./eggs.nix { inherit pkgs; inherit (pkgs) stdenv; };
in
pkgs.mkShell {
  buildInputs = with pkgs.chickenPackages_5; [
    chicken
    egg2nix
  ] ++ builtins.attrValues eggs;
}

;; example.egg
((synopsis "An egg2nix example")
 (author "Moritz Heidkamp")
 (components)
 (dependencies matchable
               clojurian
               (comparse "3")))

;; eggs.nix is generated from example.egg via egg2nix.
;; To bootstrap using the above shell.nix:
;; 
;;   echo '{ ... }: { }' > eggs.nix
;;   nix-shell --run 'egg2nix example.egg > eggs.nix'
;; 
;; Then load via nix-shell and try
;;
;;   csi -R comparse

shell.nix for an egg with foreign dep added by DerGuteMoritz on Sun Apr 11 16:15:08 2021

;; egg2nix.nix
{ chickenPackages_5, fetchFromGitHub }:
# This version of egg2nix includes a few fixes for C5 egg file compat.
# See https://github.com/DerGuteMoritz/egg2nix/commits/chicken-5
# Also, the egg2nix version available via nixpkgs was lagging a bit
# behind upstream, see https://github.com/NixOS/nixpkgs/pull/119085
chickenPackages_5.egg2nix.overrideAttrs (_: {
  src = fetchFromGitHub {
    owner = "DerGuteMoritz";
    repo = "egg2nix";
    rev = "7a42985b2eff7d120be2cec65493ad52084b4e44";
    sha256 = "1pzfmw6wlr0rlg167rdzr5w1x2pg4g5nszajwr1m6ra6k4pcksc1";
  };
})

;; example.egg
;; See paste above on how to convert this into eggs.nix
((synopsis "An egg2nix example with foreign dependency")
 (author "Moritz Heidkamp")
 (components)
 (dependencies breadline))


;; eggs-with-foreign-deps.nix
{ pkgs }:
let
  eggs = import ./eggs.nix { inherit pkgs; inherit (pkgs) stdenv; };
in
eggs // {
  breadline = eggs.breadline.overrideAttrs (old: {
    buildInputs = old.buildInputs ++ [
      pkgs.readline
    ];
  });
}


;; shell.nix
{
  pkgs ? import <nixpkgs> { }
}:
let
  egg2nix = pkgs.callPackage ./egg2nix.nix { };
  eggs = import ./eggs-with-foreign-deps.nix { inherit pkgs; };
in
pkgs.mkShell {
  buildInputs = with pkgs.chickenPackages_5; [
    chicken
    egg2nix
  ] ++ builtins.attrValues eggs;
}