• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A categorical programming language


Commit MetaInfo

修订版f47e44b34db025959bebf7d05607a039f4fd6e0f (tree)
时间2023-04-25 13:48:29
作者Corbin <cds@corb...>
CommiterCorbin

Log Message

Become a Nix flake.

I had to use nixos-22.11 because it seems like egg2nix is broken on
nixos-unstable. I'll probably have to care about that in the future.

更改概述

差异

--- a/.envrc
+++ b/.envrc
@@ -1,6 +1,6 @@
11 # export NIX_PATH=nixpkgs=/home/simpson/nixpkgs
22 export EDITOR=vim
3-use nix
3+use flake
44 eval $(keychain --eval --agents ssh)
55
66 # export CAMMY_HIVE="$(pwd)/hive/"
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,61 @@
1+{
2+ "nodes": {
3+ "flake-utils": {
4+ "inputs": {
5+ "systems": "systems"
6+ },
7+ "locked": {
8+ "lastModified": 1681202837,
9+ "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
10+ "owner": "numtide",
11+ "repo": "flake-utils",
12+ "rev": "cfacdce06f30d2b68473a46042957675eebb3401",
13+ "type": "github"
14+ },
15+ "original": {
16+ "owner": "numtide",
17+ "repo": "flake-utils",
18+ "type": "github"
19+ }
20+ },
21+ "nixpkgs": {
22+ "locked": {
23+ "lastModified": 1682303062,
24+ "narHash": "sha256-x+KAADp27lbxeoPXLUMxKcRsUUHDlg+qVjt5PjgBw9A=",
25+ "owner": "NixOS",
26+ "repo": "nixpkgs",
27+ "rev": "f5364316e314436f6b9c8fd50592b18920ab18f9",
28+ "type": "github"
29+ },
30+ "original": {
31+ "owner": "NixOS",
32+ "ref": "nixos-22.11",
33+ "repo": "nixpkgs",
34+ "type": "github"
35+ }
36+ },
37+ "root": {
38+ "inputs": {
39+ "flake-utils": "flake-utils",
40+ "nixpkgs": "nixpkgs"
41+ }
42+ },
43+ "systems": {
44+ "locked": {
45+ "lastModified": 1681028828,
46+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
47+ "owner": "nix-systems",
48+ "repo": "default",
49+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
50+ "type": "github"
51+ },
52+ "original": {
53+ "owner": "nix-systems",
54+ "repo": "default",
55+ "type": "github"
56+ }
57+ }
58+ },
59+ "root": "root",
60+ "version": 7
61+}
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,85 @@
1+{
2+ description = "Reference toolchain for Cammy";
3+ inputs = {
4+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
5+ flake-utils.url = "github:numtide/flake-utils";
6+ };
7+ outputs = { self, nixpkgs, flake-utils }:
8+ flake-utils.lib.eachDefaultSystem (system:
9+ let
10+ pkgs = import nixpkgs {
11+ inherit system;
12+ };
13+ jelly = import ./jelly { inherit pkgs; };
14+ sampler = import ./sampler { inherit pkgs; };
15+ movelist = import ./movelist { inherit pkgs jelly sampler; };
16+ cammy = pkgs.stdenv.mkDerivation {
17+ name = "cammy";
18+ version = "0.4";
19+
20+ src = ./.;
21+
22+ buildInputs = [ pkgs.makeWrapper ];
23+
24+ # outputs = [ "bin" "lib" "out" ];
25+ outputs = [ "bin" "out" ];
26+
27+ installPhase = ''
28+ mkdir -p $bin/bin/
29+
30+ makeWrapper ${jelly}/bin/jelly $bin/bin/cammy-jelly
31+
32+ makeWrapper ${movelist}/bin/cammy-djinn $bin/bin/cammy-djinn
33+ makeWrapper ${movelist}/bin/cammy-repl $bin/bin/cammy-repl
34+
35+ makeWrapper ${sampler}/bin/cammy-sample $bin/bin/cammy-sample
36+
37+ # mkdir -p $lib/lib/cammy/
38+ # cp -R hive/ $lib/lib/cammy/
39+ '';
40+ };
41+ in {
42+ packages = {
43+ inherit jelly movelist sampler;
44+ default = cammy;
45+ };
46+ devShells.default = pkgs.mkShell {
47+ packages = with pkgs; [
48+ # debugging native code
49+ gdb checksec
50+ # maintaining movelist/
51+ egg2nix
52+ # maintaining cammy-rpy/
53+ # python2Packages.pyflakes
54+ python39Packages.pyflakes
55+ # using cammy-draw
56+ pv
57+ # using cammy-repl
58+ rlwrap
59+ # working with sexps
60+ # ocamlPackages.sexp
61+ # working with JSON
62+ jq
63+ # benchmarking
64+ busybox feedgnuplot linuxPackages.perf
65+ # publishing
66+ keychain mktorrent pngcrush
67+ # experimenting with GLSL
68+ mesa-demos
69+ # comparing prototypes
70+ sloccount
71+ # experimenting with hive management
72+ ranger
73+ # Honey
74+ python39Packages.flask purescript
75+ # Documentation
76+ graphviz
77+ # experimenting with Honey
78+ wabt binaryen
79+ # openapi-generator-cli yaml2json python3Packages.virtualenv
80+ # experimenting with specification
81+ # pantagruel
82+ ];
83+ };
84+ });
85+}
--- a/jelly/default.nix
+++ b/jelly/default.nix
@@ -1,9 +1,9 @@
1-{ nixpkgs ? import <nixpkgs> {} }:
1+{ pkgs ? import <nixpkgs> {} }:
22 let
3- vanillaJelly = (import ./Cargo.nix { pkgs = nixpkgs; }).rootCrate.build;
3+ vanillaJelly = (import ./Cargo.nix { inherit pkgs; }).rootCrate.build;
44 in vanillaJelly.overrideAttrs (attrs: {
55 doCheck = true;
66 checkPhase = ''
7- ${nixpkgs.python3}/bin/python accept-jelly.py target/bin/jelly
7+ ${pkgs.python3}/bin/python accept-jelly.py target/bin/jelly
88 '';
99 })
--- a/movelist/default.nix
+++ b/movelist/default.nix
@@ -1,6 +1,5 @@
1-{ jelly, sampler, nixpkgs ? import <nixpkgs> {} }:
1+{ jelly, sampler, pkgs ? import <nixpkgs> {} }:
22 let
3- pkgs = nixpkgs.pkgs;
43 eggs = import ./eggs.nix {
54 inherit pkgs;
65 stdenv = pkgs.stdenv;
--- /dev/null
+++ b/movelist/jets.json
@@ -0,0 +1,9 @@
1+{
2+ "dup": ["pair", "id", "id"],
3+ "swap": ["pair", "snd", "fst"],
4+ "app": ["uncurry", "id"],
5+ "n-pred-maybe": ["pr", "right", ["comp", ["case", "succ", "zero"], "left"]],
6+ "n-add": ["uncurry", ["pr", ["curry", "snd"], ["curry", ["comp", "app", "succ"]]]],
7+ "n-mul": ["uncurry", ["pr", ["curry", ["comp", "ignore", "zero"]], ["curry", ["comp", ["pair", "app", "snd"], "n-add"]]]],
8+ "n-double": ["pr", "zero", ["comp", "succ" ,"succ"]]
9+}
--- a/sampler/default.nix
+++ b/sampler/default.nix
@@ -1,6 +1,6 @@
1-{ nixpkgs ? import <nixpkgs> {} }:
1+{ pkgs ? import <nixpkgs> {} }:
22 let
3- inherit (nixpkgs.pkgs)
3+ inherit (pkgs)
44 fetchhg stdenv
55 pkg-config libffi stb libcaca
66 python2 python2Packages;
--- a/todo.txt
+++ b/todo.txt
@@ -63,8 +63,13 @@
6363 * pr : Ord(X) -> Y, given 1 -> Y, Y -> Y
6464 * To still be able to infer Ord(X) ~ N, would require noticing (lt X N)
6565 situations and widening X correctly when extracting types
66+ * cast-ord : N -> Ord(X) + 1
67+ * No lte constraints!
68+ * Allows programmer to ignore widths as long as they handle failures
6669 * Use cases
6770 * Generalized matrices: Ord(X) × Ord(Y) -> F is like an X×Y matrix
71+ * Except that the curried row/column array Ord(X) -> [Ord(Y),F] is lazy
72+ * Can't be eager because curry is promised to be cheap!
6873 * Polynomial functors: X² + X + 1 can literally be encoded as:
6974 * X -> [2, X] + (X + 1)
7075 * So we could generalize that to any ordinal
@@ -432,3 +437,5 @@
432437 * We'd need an equivalence X × 1 → X
433438 * fun/precomp is an ingredient of CPS transformation
434439 * https://okmij.org/ftp/continuations/undelimited.html
440+ * Theories/typeclasses
441+ * Put signatures and instances into new section of hive