diff --git a/flake.nix b/flake.nix index 4f8f0cf..aa000f8 100644 --- a/flake.nix +++ b/flake.nix @@ -11,20 +11,49 @@ pkgs = nixpkgs.legacyPackages.${system}; lib = pkgs.lib; # FIXME: Lua is borked at the moment :( - # lua = pkgs.lua5_3.withPackages(ps: with ps; [ - # readline - # # cjson - # # http - # luarocks - # ]); - # fennel = pkgs.fennel.override { lua = lua; }; + lua = pkgs.lua5_3.withPackages(ps: with ps; [ + readline + cjson + http + luarocks + ]); + fennel = pkgs.fennel.override { lua = lua; }; + gambit = pkgs.callPackage "${nixpkgs.outPath}/pkgs/development/compilers/gambit/build.nix" rec { + version = "4.9.4"; + git-version = version; + src = pkgs.fetchFromGitHub { + owner = "gambit"; + repo = "gambit"; + rev = "3bbd8a2959670c145f73cd25740d99a6834ac787"; + sha256 = "111hhqkmn9knqbyfzxxg81sshyh3p6n7ywp32vrhx1ckqdk7rcjf"; + }; + }; in { devShells.default = pkgs.mkShell rec { buildInputs = [ + lua + # fennel pkgs.chicken # pkgs.guile_3_0 + # pkgs.gcc + # pkgs.gambit ]; - # LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}"; + LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}"; + }; + packages.default = pkgs.mkDerivation rec { + buildInputs = [ + pkgs.chicken + # pkgs.guile_3_0 + pkgs.gcc + pkgs.gambit + ]; + + buildPhase = '' + chicken ./main.scm -explicit-use + gcc + ''; + + LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}"; }; }); } diff --git a/main.scm b/main.scm index d3d6bd8..d1ec6c4 100644 --- a/main.scm +++ b/main.scm @@ -1,9 +1,10 @@ (import (chicken io) (chicken process-context) - (chicken random)) + (chicken random) + (chicken format)) (define *api-url* (get-environment-variable "MASTODON_API_URL")) -(define *access-tolen* (get-environment-variable "MASTODON_ACCESS_TOKEN")) +(define *access-token* (get-environment-variable "MASTODON_ACCESS_TOKEN")) (define (file-lines file-path) (let ((file (open-input-file file-path))) @@ -28,4 +29,6 @@ (cons (car ls) (list-remove-nth (cdr ls) (- n 1))))) (let ((nth (pseudo-random-integer (length lines)))) - (display (list-nth lines nth))) + (display "Seize the means of ") + (display (list-nth lines nth)) + (display "\n"))