Skip to content

Instantly share code, notes, and snippets.

@jefdaj
Created June 16, 2020 17:59
Show Gist options
  • Save jefdaj/3f1f6d9581561e114a4f264acc642434 to your computer and use it in GitHub Desktop.
Save jefdaj/3f1f6d9581561e114a4f264acc642434 to your computer and use it in GitHub Desktop.
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "computational-category-theory";
buildInputs = [
smlnj
];
shellHook = ''
cd programs
sml
exit
'';
}
@ryanorendorff
Copy link

At the moment I am using this to also fetch the code. It is not exactly pure, since I should be checking that the hash of the result is the same but eh.

let

  pkgs = import (fetchTarball {
    url =
      "https://github.com/NixOS/nixpkgs-channels/archive/0a146054bdf6f70f66de4426f84c9358521be31e.tar.gz";
    sha256 = "154ypjfhy9qqa0ww6xi7d8280h85kffqaqf6b6idymizga9ckjcd";
  }) { config = { allowUnfree = true; }; };

  optional = pkgs.lib.lists.optional;

  get-programs = pkgs.writeShellScript "get-programs" ''
    if [ ! -f "Readme" ]; then
      ${pkgs.wget}/bin/wget    \
        --recursive            \
        --no-parent            \
        -e robots=off          \
        --reject="index.html*" \
        --cut-dirs=3           \
        -nH                    \
        "http://www.cs.man.ac.uk/~david/categories/programs/"
    fi
  '';

in with pkgs;
stdenv.mkDerivation {
  name = "computational-category-theory";
  nativeBuildInputs = [ get-programs ];
  buildInputs = optional stdenv.isLinux smlnj ;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment