pkgs: introduce racket and racketPackages

This commit is contained in:
xenia 2025-10-09 22:42:57 -04:00
parent 7a4ba8207a
commit e4b1c22582
35 changed files with 1366 additions and 0 deletions

View File

@ -79,4 +79,21 @@ final: prev: {
texliveDragonPackages = { texliveDragonPackages = {
moloch = prev.callPackage ./pkgs/tex/moloch {}; moloch = prev.callPackage ./pkgs/tex/moloch {};
}; };
racket-minimal = final.callPackage ./pkgs/racket/racket/minimal.nix {};
racket = final.callPackage ./pkgs/racket/racket/package.nix {};
racketPackages = let
names = builtins.readDir ./pkgs/racket/racket-catalog |> final.lib.attrNames;
byName = self:
final.lib.map (name: {
inherit name;
value = self.callPackage ./pkgs/racket/racket-catalog/${name} {};
}) names |>
final.lib.listToAttrs;
in final.lib.makeScope final.newScope (self: {
racketInstallHook = self.callPackage ./pkgs/racket/racket-install-hook.nix {};
buildRacketPackage = self.callPackage ./pkgs/racket/build-racket-package.nix {};
makeRacketEnv = self.callPackage ./pkgs/racket/make-racket-env.nix {};
} // (byName self));
} }

View File

@ -0,0 +1,73 @@
{
lib,
racket,
racketInstallHook,
stdenv,
wrapGAppsHook3,
}: lib.extendMkDerivation {
constructDrv = stdenv.mkDerivation;
excludeDrvArgNames = [
"dependencies"
"tetheredInstallation"
"doMainSetup"
"buildDocs"
"gitSubpath"
];
extendDrvArgs = finalAttrs:
{
pname,
version,
nativeBuildInputs ? [],
propagatedBuildInputs ? [],
dependencies ? [],
tetheredInstallation ? false,
doMainSetup ? tetheredInstallation,
buildDocs ? tetheredInstallation,
gitSubpath ? ".",
...
} @ attrs: {
name = "racket${racket.version}-" + pname + "-" + version;
strictDeps = true;
dontConfigure = true;
dontBuild = true;
racketTetheredInstallation = tetheredInstallation;
racketDoMainSetup = doMainSetup;
racketBuildDocs = buildDocs;
racketGitSubpath = gitSubpath;
nativeBuildInputs = [
racket
racketInstallHook
wrapGAppsHook3
] ++ nativeBuildInputs;
propagatedBuildInputs = [racket] ++ dependencies ++ propagatedBuildInputs;
dontWrapGApps = true;
preFixup = ''
find $out/bin -type f -executable -print0 |
while IFS= read -r -d ''' f; do
if test "$(file --brief --mime-type "$f")" = application/x-executable; then
wrapGApp "$f"
fi
done
'' + (lib.optionalString (!tetheredInstallation) ''
find $out/bin -type f -executable -print0 |
while IFS= read -r -d ''' f; do
if test "$(file --brief --mime-type "$f")" = text/x-shellscript; then
substituteInPlace "$f" \
--replace-fail "\"\''${bindir}/racket\"" \
"\"\''${bindir}/racket\" --config $out/etc/racket/"
fi
done
'');
};
}

View File

@ -0,0 +1,17 @@
{
lib,
racket,
buildRacketPackage,
}: {
packages,
}: buildRacketPackage {
pname = "env";
version = "0";
unpackPhase = "touch nix-racket-env-only";
dependencies = packages;
tetheredInstallation = true;
racketEnvOnly = true;
}

View File

@ -0,0 +1,28 @@
{
lib,
buildRacketPackage,
fetchFromGitHub,
}: (buildRacketPackage {
pname = "ansi-color";
version = "0.2+20363d9";
dependencies = [];
src = fetchFromGitHub {
owner = "renatoathaydes";
repo = "ansi-color";
rev = "20363d90fcef9219580ec0d6a78eea834df39d21";
hash = "sha256-PdTF4KaDecp7hYHlUAXXmZEfuvEfSF6Gf9A558b6v/I=";
};
gitSubpath = ".";
passthru = {
racketModules = ["ansi-color/main.rkt" "ansi-color/display.rkt" "ansi-color/scribblings/ansi-color.scrbl" "ansi-color/demo.rkt"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "A library to make it easy to write colorized and styled output in terminals that support ANSI escape codes (most command lines).";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."LGPL-3.0-or-later")];
homepage = "https://github.com/renatoathaydes/ansi-color/tree/HEAD/README.md";
};
})

View File

@ -0,0 +1,26 @@
{
lib,
fetchgit,
buildRacketPackage,
}: (buildRacketPackage {
pname = "br-parser-tools-lib";
version = "0.0+95b7c69";
dependencies = [];
src = fetchgit {
url = "https://gitlab.com/mbutterick/br-parser-tools.git";
rev = "95b7c69cf9d660a51abf4742378b9adb7100d25a";
hash = "sha256-and0y3rBjXwmgaEwwXzJOTgX/wCSY0uUfB3+U4JLTrk=";
};
gitSubpath = "br-parser-tools-lib";
passthru = {
racketModules = ["br-parser-tools/private-yacc/table.rkt" "br-parser-tools/private-lex/actions.rkt" "br-parser-tools/private-lex/stx.rkt" "br-parser-tools/private-yacc/yacc-helper.rkt" "br-parser-tools/private-lex/token-syntax.rkt" "br-parser-tools/examples/read.rkt" "br-parser-tools/yacc-to-scheme.rkt" "br-parser-tools/private-lex/token.rkt" "br-parser-tools/private-lex/unicode-chars.rkt" "br-parser-tools/private-yacc/input-file-parser.rkt" "br-parser-tools/private-lex/deriv.rkt" "br-parser-tools/lex.rkt" "br-parser-tools/private-yacc/lalr.rkt" "br-parser-tools/private-yacc/parser-builder.rkt" "br-parser-tools/private-yacc/graph.rkt" "br-parser-tools/private-yacc/lr0.rkt" "br-parser-tools/private-lex/error-tests.rkt" "br-parser-tools/cfg-parser.rkt" "br-parser-tools/private-lex/front.rkt" "br-parser-tools/yacc.rkt" "br-parser-tools/private-lex/re.rkt" "br-parser-tools/lex-sre.rkt" "br-parser-tools/private-yacc/parser-actions.rkt" "br-parser-tools/examples/calc.rkt" "br-parser-tools/lex-plt-v200.rkt" "br-parser-tools/private-yacc/grammar.rkt" "br-parser-tools/private-lex/util.rkt"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "fork of `parser-tools-lib` for Beautiful Racket";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."LGPL-3.0-or-later")];
};
})

View File

@ -0,0 +1,27 @@
{
lib,
br-parser-tools-lib,
fetchgit,
buildRacketPackage,
}: (buildRacketPackage {
pname = "brag-lib";
version = "0.0+30cbf95";
dependencies = [br-parser-tools-lib];
src = fetchgit {
url = "https://gitlab.com/mbutterick/brag.git";
rev = "30cbf95e6a717e71fb8bda6b15a7253aed36115a";
hash = "sha256-NJctskWDoBNRdBMDklALkMAPKT4A7on8pu6X3Q6NheE=";
};
gitSubpath = "brag-lib";
passthru = {
racketModules = ["brag/test/test-cutter.rkt" "brag/rules/rule-structs.rkt" "brag/examples/simple-line-drawing/examples/letter-i.rkt" "brag/test/test-hide-and-splice.rkt" "brag/test/test-simple-arithmetic-grammar.rkt" "brag/codegen/reader.rkt" "brag/codegen/codegen.rkt" "brag/examples/whitespace.rkt" "brag/examples/0n1.rkt" "brag/test/test-wordy.rkt" "brag/private/internal-support.rkt" "brag/examples/top-level-cut-3.rkt" "brag/examples/simple-line-drawing/lexer.rkt" "brag/examples/simple-arithmetic-grammar.rkt" "brag/test/test-parser.rkt" "brag/test/test-start-and-atok.rkt" "brag/examples/simple-line-drawing.rkt" "brag/rules/parser.rkt" "brag/examples/top-level-cut-2.rkt" "brag/main.rkt" "brag/test/test-0n1n.rkt" "brag/examples/simple-line-drawing/grammar.rkt" "brag/examples/wordy.rkt" "brag/rules/lexer.rkt" "brag/test/test-cutter-another.rkt" "brag/private/indenter.rkt" "brag/examples/cutter.rkt" "brag/examples/empty-symbol.rkt" "brag/examples/01-equal.rkt" "brag/test/test-baby-json.rkt" "brag/test/test-0n1.rkt" "brag/examples/baby-json-hider.rkt" "brag/test/test-empty-symbol.rkt" "brag/rules/stx-types.rkt" "brag/test/test-make-rule-parser.rkt" "brag/examples/simple-line-drawing/lang/reader.rkt" "brag/examples/top-level-cut-1.rkt" "brag/test/test-weird-grammar.rkt" "brag/test/test-whitespace.rkt" "brag/codegen/satisfaction.rkt" "brag/examples/nested-repeats.rkt" "brag/examples/simple-line-drawing/interpret.rkt" "brag/test/test-flatten.rkt" "brag/test/weird-grammar.rkt" "brag/test/test-all.rkt" "brag/examples/baby-json-alt2.rkt" "brag/examples/baby-json.rkt" "brag/test/test-01-equal.rkt" "brag/examples/statlist-grammar.rkt" "brag/examples/simple-line-drawing/semantics.rkt" "brag/examples/subrule.rkt" "brag/examples/lua-parser.rkt" "brag/test/test-quotation-marks-and-backslashes.rkt" "brag/test/test-lexer.rkt" "brag/test/test-nested-repeats.rkt" "brag/test/test-baby-json-hider.rkt" "brag/examples/start-and-atok.rkt" "brag/rules/stx.rkt" "brag/examples/add-mult.rkt" "brag/test/test-old-token.rkt" "brag/examples/cutter-another.rkt" "brag/test/test-top-level-cut.rkt" "brag/examples/bnf.rkt" "brag/codegen/runtime.rkt" "brag/test/test-codepoints.rkt" "brag/examples/codepoints.rkt" "brag/test/test-simple-line-drawing.rkt" "brag/test/test-errors.rkt" "brag/examples/hide-and-splice.rkt" "brag/examples/curly-quantifier.rkt" "brag/examples/nested-word-list.rkt" "brag/codegen/expander.rkt" "brag/examples/0n1n.rkt" "brag/private/colorer.rkt" "brag/codegen/flatten.rkt" "brag/examples/quotation-marks-and-backslashes.rkt" "brag/support.rkt" "brag/test/test-curly-quantifier.rkt" "brag/examples/baby-json-alt.rkt"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."MIT")];
};
})

View File

@ -0,0 +1,28 @@
{
lib,
cldr-core,
buildRacketPackage,
fetchFromGitHub,
}: (buildRacketPackage {
pname = "cldr-bcp47";
version = "0.0+823fc1a";
dependencies = [cldr-core];
src = fetchFromGitHub {
owner = "97jaz";
repo = "cldr-bcp47";
rev = "823fc1a530f1a0ec4de59f5454c1a17f20c5a5d6";
hash = "sha256-YY5q44IQ1cNX4wk8Yt7B+z2uvfy+xMSl5tTDs+1RBlA=";
};
gitSubpath = ".";
passthru = {
racketModules = ["cldr/bcp47/timezone.rkt" "cldr/bcp47/scribblings/cldr-bcp47-timezone.scrbl"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "API for BCP47 extensions to CLDR";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."MIT") (((lib).licensesSpdx)."Unicode-TOU")];
};
})

View File

@ -0,0 +1,28 @@
{
lib,
buildRacketPackage,
fetchFromGitHub,
memoize-lib,
}: (buildRacketPackage {
pname = "cldr-core";
version = "0.0+c9b8077";
dependencies = [memoize-lib];
src = fetchFromGitHub {
owner = "97jaz";
repo = "cldr-core";
rev = "c9b80777c422c3b104bb85052d74a2dc1535a3c3";
hash = "sha256-Tpk6uYWz4//C+/n50wsLiD16rwOim85R/Ykrtcoa1+8=";
};
gitSubpath = ".";
passthru = {
racketModules = ["cldr/file.rkt" "cldr/likely-subtags.rkt" "cldr/core.rkt" "cldr/scribblings/cldr-core.scrbl"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "API for cldr-core data set";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."MIT") (((lib).licensesSpdx)."Unicode-TOU")];
};
})

View File

@ -0,0 +1,28 @@
{
lib,
cldr-core,
buildRacketPackage,
fetchFromGitHub,
}: (buildRacketPackage {
pname = "cldr-dates-modern";
version = "0.0+c362829";
dependencies = [cldr-core];
src = fetchFromGitHub {
owner = "97jaz";
repo = "cldr-dates-modern";
rev = "c36282917247f6a069e553535f4619007cd7b6e5";
hash = "sha256-byD2ubs543P9512lKD1JKB1ppyzjKzoWnuW8JPspa7M=";
};
gitSubpath = ".";
passthru = {
racketModules = ["cldr/dates-modern.rkt" "cldr/scribblings/cldr-dates-modern.scrbl"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "API for cldr-dates-modern data set";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."MIT") (((lib).licensesSpdx)."Unicode-TOU")];
};
})

View File

@ -0,0 +1,28 @@
{
lib,
cldr-core,
buildRacketPackage,
fetchFromGitHub,
}: (buildRacketPackage {
pname = "cldr-localenames-modern";
version = "0.0+f9f3e8d";
dependencies = [cldr-core];
src = fetchFromGitHub {
owner = "97jaz";
repo = "cldr-localenames-modern";
rev = "f9f3e8d9245764a309542816acf40fe147b473a3";
hash = "sha256-fZ1fnkslpZuicJgMh6/aLd4rPov7lvJr6ulDWpTMpKg=";
};
gitSubpath = ".";
passthru = {
racketModules = ["cldr/scribblings/cldr-localenames-modern.scrbl" "cldr/localenames-modern.rkt"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "API for cldr-localenames-modern data set";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."MIT") (((lib).licensesSpdx)."Unicode-TOU")];
};
})

View File

@ -0,0 +1,28 @@
{
lib,
cldr-core,
buildRacketPackage,
fetchFromGitHub,
}: (buildRacketPackage {
pname = "cldr-numbers-modern";
version = "0.0+6254280";
dependencies = [cldr-core];
src = fetchFromGitHub {
owner = "97jaz";
repo = "cldr-numbers-modern";
rev = "625428099b3f8cd264955a283dddc176a6080ba1";
hash = "sha256-RDa1d4sSyfyuNgz2dJdu2f1XGiO4cPOkaseZ7q2cLJU=";
};
gitSubpath = ".";
passthru = {
racketModules = ["cldr/scribblings/cldr-numbers-modern.scrbl" "cldr/numbers-modern.rkt"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "API for cldr-numbers-modern data set";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."MIT") (((lib).licensesSpdx)."Unicode-TOU")];
};
})

View File

@ -0,0 +1,27 @@
{
lib,
buildRacketPackage,
fetchFromGitHub,
}: (buildRacketPackage {
pname = "fancy-app";
version = "1.1+f451852";
dependencies = [];
src = fetchFromGitHub {
owner = "samth";
repo = "fancy-app";
rev = "f451852164ee67e3e122f25b4bce45001a557045";
hash = "sha256-2DdngIyocn+CrLf4A4yO9+XJQjIxzKVpmvGiNuM7mTQ=";
};
gitSubpath = ".";
passthru = {
racketModules = ["fancy-app/main.scrbl" "fancy-app/main.rkt"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "Scala-style anonymous functions";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."MIT")];
};
})

View File

@ -0,0 +1,29 @@
{
lib,
buildRacketPackage,
pretty-expressive,
fetchFromGitHub,
}: (buildRacketPackage {
pname = "fmt";
version = "0.0.3+002818e";
dependencies = [pretty-expressive];
src = fetchFromGitHub {
owner = "sorawee";
repo = "fmt";
rev = "002818ec08ad6e5e01f79e6209b69203581d6adc";
hash = "sha256-/oLq5WPpK/OO3ED7PBKTMCjDxTBy8+ZjoL/WPPC1zlU=";
};
gitSubpath = ".";
passthru = {
racketModules = ["fmt/tests/test-cases/let-cc-ec.rkt" "fmt/read.rkt" "fmt/tests/test-cases/test-dot.rkt" "fmt/realign.rkt" "fmt/tests/test-cases/test-deinprogramm.rkt" "fmt/tests/test-cases/define-contract.rkt" "fmt/scribblings/kws.rkt" "fmt/tests/test-cases/define-match.rkt" "fmt/tests/test-cases/general.rkt" "fmt/for-profiling.rkt" "fmt/tests/test-cases/send.rkt" "fmt/tests/benchmarks/class-internal.rkt" "fmt/params.rkt" "fmt/tests/test-cases/test-quasisyntax.rkt" "fmt/tests/test-cases/large2.rkt" "fmt/tests/permission-test.rkt" "fmt/.fmt.rkt" "fmt/tests/test-cases/cr.rkt" "fmt/tests/test-cases/test-asl.rkt" "fmt/private/memoize.rkt" "fmt/tests/benchmarks/xform.rkt" "fmt/tests/test-cases/test-if.rkt" "fmt/version.rkt" "fmt/core.rkt" "fmt/tests/benchmarks/list.rkt" "fmt/tokenize.rkt" "fmt/raco.rkt" "fmt/conventions.rkt" "fmt/tests/test-cases/large.rkt" "fmt/tests/config-tests/file.rkt" "fmt/tests/test-cases/rackunit.rkt" "fmt/tests/benchmarks/hash.rkt" "fmt/tests/test-cases/test-hash-bang.rkt" "fmt/tests/test-cases/test-herestring.rkt" "fmt/tests/config-tests/config.rkt" "fmt/scribblings/fmt.scrbl" "fmt/record.rkt" "fmt/tests/test-cases/test-class.rkt" "fmt/common.rkt" "fmt/tests/test-cases/let-values.rkt" "fmt/tests/test-cases/test-lambda.rkt" "fmt/scribblings/examples/example.rkt" "fmt/tests/test-cases/delay.rkt" "fmt/main.rkt" "fmt/scribblings/util.rkt" "fmt/regen.rkt"];
racketLaunchers = [];
racoCommands = ["fmt"];
};
meta = {
description = "An extensible code formatter for Racket";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."Apache-2.0") (((lib).licensesSpdx)."MIT")];
homepage = "https://github.com/sorawee/fmt/tree/HEAD/README.md";
};
})

View File

@ -0,0 +1,35 @@
{
fetchFromGitHub,
cldr-localenames-modern,
memoize-lib,
cldr-bcp47,
cldr-dates-modern,
lib,
cldr-core,
buildRacketPackage,
cldr-numbers-modern,
tzinfo,
}: (buildRacketPackage {
pname = "gregor-lib";
version = "0.0+f56215d";
dependencies = [memoize-lib tzinfo cldr-core cldr-bcp47 cldr-numbers-modern cldr-dates-modern cldr-localenames-modern];
src = fetchFromGitHub {
owner = "97jaz";
repo = "gregor";
rev = "f56215db229ef2e33670f55d08c0330d8f85de23";
hash = "sha256-4TIeinXk7ak7sbT2lwfWYdwIwFD9S7whBrR2KEajW30=";
};
gitSubpath = "gregor-lib";
passthru = {
racketModules = ["gregor/private/pattern/l10n/numbers.rkt" "gregor/private/period.rkt" "gregor/private/pattern/l10n/zone-util.rkt" "gregor/private/pattern/ast/era.rkt" "gregor/private/pattern/ast/second.rkt" "gregor/private/pattern/l10n/gmt-offset.rkt" "gregor/private/pattern/ast/hour.rkt" "gregor/private/pattern/ast/minute.rkt" "gregor/private/pattern/l10n/named-trie.rkt" "gregor/private/core/compare.rkt" "gregor/private/pattern/ast/week.rkt" "gregor/private/iso8601-parse.rkt" "gregor/main.rkt" "gregor/private/pattern/l10n/l10n-week.rkt" "gregor/private/pattern/l10n/iso-offset.rkt" "gregor/private/pattern/l10n/trie.rkt" "gregor/private/exn.rkt" "gregor/private/pattern/l10n/zone-id.rkt" "gregor/time.rkt" "gregor/private/pattern/lexer.rkt" "gregor/private/clock.rkt" "gregor/private/pattern/l10n/zone-loc.rkt" "gregor/private/pattern/ast.rkt" "gregor/private/pattern/l10n/symbols.rkt" "gregor/private/pattern/ast/year.rkt" "gregor/private/pattern/ast/zone.rkt" "gregor/private/pattern/parse-state.rkt" "gregor/private/pattern/ast/literal.rkt" "gregor/private/difference.rkt" "gregor/private/core/math.rkt" "gregor/private/pattern/ast/month.rkt" "gregor/private/time.rkt" "gregor/private/pattern/ast/period.rkt" "gregor/private/pattern/ast/weekday.rkt" "gregor/private/datetime.rkt" "gregor/private/moment-base.rkt" "gregor/private/pattern/ast/day.rkt" "gregor/private/parse.rkt" "gregor/private/date.rkt" "gregor/private/moment.rkt" "gregor/private/format.rkt" "gregor/private/pattern/l10n/zone-nonloc.rkt" "gregor/private/generics.rkt" "gregor/period.rkt" "gregor/private/pattern/ast/separator.rkt" "gregor/private/core/structs.rkt" "gregor/private/core/hmsn.rkt" "gregor/private/pattern/l10n/metazone.rkt" "gregor/private/pattern/ast/quarter.rkt" "gregor/private/core/ymd.rkt" "gregor/private/offset-resolvers.rkt"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "Code part of the gregor date and time library";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."MIT")];
homepage = "https://github.com/97jaz/gregor/tree/HEAD/README.md";
};
})

View File

@ -0,0 +1,28 @@
{
lib,
buildRacketPackage,
fetchFromGitHub,
}: (buildRacketPackage {
pname = "guard";
version = "0.0+de93f4b";
dependencies = [];
src = fetchFromGitHub {
owner = "jackfirth";
repo = "guard";
rev = "de93f4b5f38f1086177a09a40583af2932759b75";
hash = "sha256-z5sUidOIadtOZqVRBPxjIAz/D71U9XiE06EE+DGZzBg=";
};
gitSubpath = ".";
passthru = {
racketModules = ["guard/private/scribble-evaluator-factory.rkt" "guard/scribblings/guard.scrbl" "guard/main.rkt"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "Macros similar to Swift's \"guard statements\".";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."Apache-2.0") (((lib).licensesSpdx)."MIT")];
homepage = "https://github.com/jackfirth/guard/tree/HEAD/README.md";
};
})

View File

@ -0,0 +1,28 @@
{
lib,
buildRacketPackage,
fetchFromGitHub,
}: (buildRacketPackage {
pname = "memoize-lib";
version = "3.0+f373706";
dependencies = [];
src = fetchFromGitHub {
owner = "jbclements";
repo = "memoize";
rev = "f373706824145ce2a8247edb76278d6df139333c";
hash = "sha256-87a5nSpOZaal1/t5GMk5yFHX1daukabYQ/1J4L5LN4o=";
};
gitSubpath = "memoize-lib";
passthru = {
racketModules = ["memoize/main.rkt"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "core library for memoize";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."MIT")];
homepage = "https://github.com/jbclements/memoize/tree/master/README.md";
};
})

View File

@ -0,0 +1,29 @@
{
gregor-lib,
buildRacketPackage,
lib,
fetchFromGitHub,
}: (buildRacketPackage {
pname = "north";
version = "0.8+00e5221";
dependencies = [gregor-lib];
src = fetchFromGitHub {
owner = "Bogdanp";
repo = "racket-north";
rev = "00e52217081d421bcdd1c2248e309e0d92dd5314";
hash = "sha256-oSjrLNsQ53vUIFRF2spie7o/NSrlF29Dqw2et9Isf3o=";
};
gitSubpath = "north";
passthru = {
racketModules = ["north/main.rkt" "north/north.scrbl" "north/tool/syntax-color.rkt" "north/adapter/sqlite.rkt" "north/adapter/base.rkt" "north/migrate.rkt" "north/adapter/postgres.rkt" "north/lang/reader.rkt" "north/base.rkt" "north/cli.rkt"];
racketLaunchers = [];
racoCommands = ["north"];
};
meta = {
description = "A database migration tool.";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."BSD-3-Clause")];
homepage = "https://github.com/Bogdanp/racket-north/tree/HEAD/README.md";
};
})

View File

@ -0,0 +1,28 @@
{
lib,
buildRacketPackage,
fetchFromGitHub,
}: (buildRacketPackage {
pname = "pretty-expressive";
version = "1.1+0984931";
dependencies = [];
src = fetchFromGitHub {
owner = "sorawee";
repo = "pretty-expressive";
rev = "0984931c6f8ff32921dd477c875127de7600dfd5";
hash = "sha256-5WokTHS90pYo5ltJEWX5MIMyUWr2AlRU/W2bznLQ74U=";
};
gitSubpath = ".";
passthru = {
racketModules = ["pretty-expressive/benchmarks/json.rkt" "pretty-expressive/core.rkt" "pretty-expressive/benchmarks/sexp-random.rkt" "pretty-expressive/benchmarks/sexp-full.rkt" "pretty-expressive/benchmarks/concat.rkt" "pretty-expressive/doc.rkt" "pretty-expressive/addons.rkt" "pretty-expressive/scribblings/pretty-expressive.scrbl" "pretty-expressive/benchmarks/fill-sep.rkt" "pretty-expressive/main.rkt" "pretty-expressive/benchtool.rkt" "pretty-expressive/benchmarks/flatten.rkt" "pretty-expressive/benchmarks/wadler-opt.rkt" "pretty-expressive/examples.rkt" "pretty-expressive/process.rkt" "pretty-expressive/promise.rkt"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "A pretty expressive printer";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."Apache-2.0") (((lib).licensesSpdx)."MIT")];
homepage = "https://github.com/sorawee/pretty-expressive/tree/main/README.md";
};
})

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,29 @@
{
lib,
cldr-core,
buildRacketPackage,
fetchFromGitHub,
}: (buildRacketPackage {
pname = "tzinfo";
version = "0.6+2f81228";
dependencies = [cldr-core];
src = fetchFromGitHub {
owner = "97jaz";
repo = "tzinfo";
rev = "2f812283d9c90040aecb3c7e2ed2edf93a3720de";
hash = "sha256-vvb3EZHFysa/2OiTat+i8zuALxiCPHNNaWCGlyPF6gk=";
};
gitSubpath = ".";
passthru = {
racketModules = ["tzinfo/zoneinfo.rkt" "tzinfo/private/os/env.rkt" "tzinfo/private/os/unix.rkt" "tzinfo/private/tabfile-parser.rkt" "tzinfo/main.rkt" "tzinfo/source.rkt" "tzinfo/private/zoneinfo-search.rkt" "tzinfo/private/tzfile-parser.rkt" "tzinfo/private/os/windows.rkt" "tzinfo/private/zoneinfo.rkt" "tzinfo/private/structs.rkt" "tzinfo/test/zoneinfo.rkt" "tzinfo/private/os/windows-registry.rkt" "tzinfo/private/generics.rkt" "tzinfo/scribblings/tzinfo.scrbl"];
racketLaunchers = [];
racoCommands = [];
};
meta = {
description = "API for querying the IANA tz database";
sourceProvenance = [(((lib).sourceTypes).fromSource)];
broken = false;
license = [(((lib).licensesSpdx)."MIT")];
homepage = "https://github.com/97jaz/tzinfo/tree/HEAD/README.md";
};
})

View File

@ -0,0 +1,7 @@
{
racket,
makeSetupHook,
}: makeSetupHook {
name = "racket-install-hook";
propagatedBuildInputs = [ racket ];
} ./racket-install-hook.sh

View File

@ -0,0 +1,159 @@
echo "Sourcing racket-install-hook"
addRacketPath() {
if [ -f "$1/nix-support/racket-pkg" ]; then
addToSearchPathWithCustomDelimiter : NIX_RACKET_PKG_PATH $1
fi
}
racketInstallPhase() {
echo "Executing racketInstallPhase"
cd "$racketGitSubpath"
runHook preInstall
mkdir -p $out/{include,etc/racket,lib/racket,share/racket/pkgs,share/racket/collects,bin,share/applications,share/doc/racket,share/man}
mkdir -p $out/nix-support
touch $out/nix-support/racket-pkg
out="$out" tethered="$racketTetheredInstallation" \
racket --no-user-path -nl racket/base -f - <<EOF
(require racket/function racket/hash racket/list racket/pretty racket/string racket/match)
(define out (getenv "out"))
(define pkgs (path-list-string->path-list (or (getenv "NIX_RACKET_PKG_PATH") "") '()))
(define tethered? (equal? (getenv "tethered") "1"))
(define base-config (read-installation-configuration-table))
(define (add-to-search added-list search-list)
(match search-list
['() (error "no #f found in search list!")]
[(cons #f rst) (cons #f (append added-list rst))]
[(cons fst rst) (cons fst (add-to-search added-list rst))]))
(define (make-search-path* key list-key [pkgs-search '()])
(define old-search-list (hash-ref base-config list-key '(#f)))
(define old-value
(cond
[(hash-has-key? base-config key)
(list (hash-ref base-config key))]
[(eq? key 'links-file)
(list
(path->string
(build-path (hash-ref base-config 'share-dir) "links.rktd")))]
[else (error "no key" key)]))
(define added-list (append pkgs-search old-value))
(add-to-search added-list old-search-list))
(define (default-location pkg key)
(path->string
(match key
['include-dir (build-path pkg "include")]
['lib-dir (build-path pkg "lib/racket")]
['share-dir (build-path pkg "share/racket")]
['pkgs-dir (build-path pkg "share/racket/pkgs")]
['links-file (build-path pkg "share/racket/links.rktd")]
['bin-dir (build-path pkg "bin")]
['doc-dir (build-path pkg "share/doc/racket")]
['man-dir (build-path pkg "share/man")]
[_ (error "unexpected key:" key)])))
(define (make-search-path key list-key)
(define pkgs-search
(for/list ([pkg (in-list pkgs)])
(default-location pkg key)))
(make-search-path* key list-key pkgs-search))
(define (add-libs lib-path)
(define ldflags (string-split (getenv "NIX_LDFLAGS")))
(define libs
(for/list ([lib (in-list ldflags)] #:when (string-prefix? "-L" lib))
(string-trim "-L" #:right? #f)))
(remove-duplicates (append libs lib-path)))
(define config*
(hash
'absolute-installation? #t
'build-stamp ""
'catalogs (hash-ref base-config 'catalogs)
'compiled-file-roots (hash-ref base-config 'compiled-file-roots)
'apps-dir (path->string (build-path out "share/applications"))
'bin-dir (default-location out 'bin-dir)
'bin-search-dirs (make-search-path 'bin-dir 'bin-search-dirs)
'doc-dir (default-location out 'doc-dir)
'doc-search-dirs (make-search-path 'doc-dir 'doc-search-dirs)
'doc-search-url (hash-ref base-config 'doc-search-url)
'include-dir (default-location out 'include-dir)
'include-search-dirs (make-search-path 'include-dir 'include-search-dirs)
'lib-dir (default-location out 'lib-dir)
'lib-search-dirs (add-libs (make-search-path 'lib-dir 'lib-search-dirs))
'links-file (default-location out 'links-file)
'links-search-files (make-search-path 'links-file 'links-search-files)
'man-dir (default-location out 'man-dir)
'man-search-dirs (make-search-path 'man-dir 'man-search-dirs)
'pkgs-dir (default-location out 'pkgs-dir)
'pkgs-search-dirs (make-search-path 'pkgs-dir 'pkgs-search-dirs)
'share-dir (default-location out 'share-dir)
'share-search-dirs (make-search-path 'share-dir 'share-search-dirs)))
(define config
(if tethered?
(hash-union
config*
(hash
'config-tethered-console-bin-dir (hash-ref config* 'bin-dir)
'config-tethered-gui-bin-dir (hash-ref config* 'bin-dir)
'config-tethered-apps-dir (hash-ref config* 'apps-dir)))
config*))
(with-output-to-file (build-path out "etc/racket/config.rktd")
(curry pretty-write config))
EOF
echo Initializing installation layer
if [ "$racketTetheredInstallation" == "1" ]; then
racket --config $out/etc/racket/ --no-user-path -l- \
raco setup --no-zo
elif [ "$racketDoMainSetup" == "1" ]; then
racket --config $out/etc/racket/ --no-user-path -l- \
raco setup --no-zo --no-launcher
rm $out/bin/mzscheme # ????
fi
if [ "$racketEnvOnly" == "1" ]; then
echo Skipping raco pkg install
else
echo Running raco pkg install
racoflags=""
if [ "$racketBuildDocs" != "1" ]; then
racoflags="--no-docs"
fi
racket --config $out/etc/racket/ --no-user-path -l- \
raco pkg install --installation --deps fail --copy --name "$pname" $racoflags \
"$(readlink -e .)"
fi
runHook postInstall
echo "Finished executing racketInstallPhase"
}
if [ -z "${dontUseRacketInstall-}" ] && [ -z "${installPhase-}" ]; then
echo "Adding racket env hook"
addEnvHooks "$targetOffset" addRacketPath
echo "Using racketInstallPhase"
installPhase=racketInstallPhase
fi

View File

@ -0,0 +1,27 @@
#lang racket/base
(require
racket/function
racket/list
racket/pretty
racket/string
setup/dirs
)
(define config-file (build-path (find-config-dir) "config.rktd"))
(define lib-paths
((compose remove-duplicates
(curry map (curryr string-trim "-L" #:right? #f))
(curry filter (curryr string-prefix? "-L"))
string-split)
(getenv "NIX_LDFLAGS")))
(define config
(let* ([prev-config (read-installation-configuration-table)]
[prev-lib-search-dirs (hash-ref prev-config 'lib-search-dirs '(#f))]
[lib-search-dirs (remove-duplicates (append lib-paths prev-lib-search-dirs))])
(hash-set prev-config 'lib-search-dirs lib-search-dirs)))
(call-with-output-file config-file
#:exists 'replace
(curry pretty-write config))

View File

@ -0,0 +1,11 @@
{
"version": "8.18",
"full": {
"filename": "racket-8.18-src.tgz",
"sha256": "65477c71ec1a978a6ee4db582b9b47b1a488029d7a42e358906de154a6e5905c"
},
"minimal": {
"filename": "racket-minimal-8.18-src.tgz",
"sha256": "24b9cf8365254b43bac308192c782edfbd86363df1322c4e063b797ed0f7db66"
}
}

View File

@ -0,0 +1,175 @@
{
lib,
stdenv,
fetchurl,
libiconvReal,
libz,
lz4,
ncurses,
openssl,
sqlite,
disableDocs ? false,
callPackage,
writers,
}:
let
manifest = lib.importJSON ./manifest.json;
inherit (stdenv.hostPlatform) isDarwin;
in
stdenv.mkDerivation (finalAttrs: {
pname = "racket";
inherit (manifest) version;
src = fetchurl {
url = "https://mirror.racket-lang.org/installers/${manifest.version}/${manifest.minimal.filename}";
inherit (manifest.minimal) sha256;
};
buildInputs = [
libiconvReal
libz
lz4
ncurses
openssl
sqlite.out
];
patches = lib.optionals isDarwin [
/*
The entry point binary $out/bin/racket is codesigned at least once. The
following error is triggered as a result.
(error 'add-ad-hoc-signature "file already has a signature")
We always remove the existing signature then call add-ad-hoc-signature to
circumvent this error.
*/
./patches/force-remove-codesign-then-add.patch
];
preConfigure =
/*
The configure script forces using `libtool -o` as AR on Darwin. But, the
`-o` option is only available from Apple libtool. GNU ar works here.
*/
lib.optionalString isDarwin ''
substituteInPlace src/ChezScheme/zlib/configure \
--replace-fail 'ARFLAGS="-o"' 'AR=ar; ARFLAGS="rc"'
''
+ ''
mkdir src/build
cd src/build
'';
configureScript = "../configure";
configureFlags = [
# > docs failure: ftype-ref: ftype mismatch for #<ftype-pointer>
# "--enable-check"
"--enable-csonly"
"--enable-liblz4"
"--enable-libz"
]
++ lib.optional disableDocs "--disable-docs"
++ lib.optionals (!(finalAttrs.dontDisableStatic or false)) [
# instead of `--disable-static` that `stdenv` assumes
"--disable-libs"
# "not currently supported" in `configure --help-cs` but still emphasized in README
"--enable-shared"
]
++ lib.optionals isDarwin [
"--disable-strip"
# "use Unix style (e.g., use Gtk) for Mac OS", which eliminates many problems
"--enable-xonx"
];
# The upstream script builds static libraries by default.
dontAddStaticConfigureFlags = true;
dontStrip = isDarwin;
postFixup =
let
configureInstallation = builtins.path {
name = "configure-installation.rkt";
path = ./configure-installation.rkt;
};
in
''
$out/bin/racket -U -u ${configureInstallation}
'';
passthru = {
# Functionalities #
updateScript = {
command = ./update.py;
attrPath = "racket";
supportedFeatures = [ "commit" ];
};
writeScript =
nameOrPath:
{
libraries ? [ ],
...
}@config:
assert lib.assertMsg (libraries == [ ]) "library integration for Racket has not been implemented";
writers.makeScriptWriter (
builtins.removeAttrs config [ "libraries" ]
// {
interpreter = "${lib.getExe finalAttrs.finalPackage}";
}
) nameOrPath;
writeScriptBin = name: finalAttrs.passthru.writeScript "/bin/${name}";
# Tests #
tests = builtins.mapAttrs (name: path: callPackage path { racket = finalAttrs.finalPackage; }) {
## Basic ##
write-greeting = ./tests/write-greeting.nix;
get-version-and-variant = ./tests/get-version-and-variant.nix;
load-openssl = ./tests/load-openssl.nix;
## Nixpkgs supports ##
nix-write-script = ./tests/nix-write-script.nix;
};
};
meta = {
description = "Programmable programming language (minimal distribution)";
longDescription = ''
Racket is a full-spectrum programming language. It goes beyond
Lisp and Scheme with dialects that support objects, types,
laziness, and more. Racket enables programmers to link
components written in different dialects, and it empowers
programmers to create new, project-specific dialects. Racket's
libraries support applications from web servers and databases to
GUIs and charts.
This minimal distribution includes just enough of Racket that you can
use `raco pkg` to install more.
'';
homepage = "https://racket-lang.org/";
changelog = "https://github.com/racket/racket/releases/tag/v${finalAttrs.version}";
/*
> Racket is distributed under the MIT license and the Apache version 2.0
> license, at your option.
> The Racket runtime system embeds Chez Scheme, which is distributed
> under the Apache version 2.0 license.
*/
license = with lib.licenses; [
asl20
mit
];
sourceProvenance = with lib.sourceTypes; [
fromSource
binaryBytecode
];
maintainers = with lib.maintainers; [ rc-zb ];
mainProgram = "racket";
platforms = lib.platforms.all;
};
})

View File

@ -0,0 +1,140 @@
{
lib,
stdenv,
fetchurl,
racket-minimal,
cairo,
fontconfig,
glib,
glibcLocales,
gtk3,
libGL,
libiodbc,
libjpeg,
libpng,
makeFontsConf,
pango,
unixODBC,
wrapGAppsHook3,
disableDocs ? false,
callPackage,
}:
let
minimal = racket-minimal.override { inherit disableDocs; };
manifest = lib.importJSON ./manifest.json;
inherit (stdenv.hostPlatform) isDarwin;
in
minimal.overrideAttrs (
finalAttrs: prevAttrs: {
src = fetchurl {
url = "https://mirror.racket-lang.org/installers/${manifest.version}/${manifest.full.filename}";
inherit (manifest.full) sha256;
};
buildInputs = prevAttrs.buildInputs ++ [
(if isDarwin then libiodbc else unixODBC)
cairo
fontconfig.lib
glib
gtk3
libGL
libjpeg
libpng
pango
];
nativeBuildInputs = [
wrapGAppsHook3
];
patches = prevAttrs.patches or [ ] ++ [
/*
Hardcode variant detection because nixpkgs wraps the Racket binary making it
fail to detect its variant at runtime.
https://github.com/NixOS/nixpkgs/issues/114993#issuecomment-812951247
*/
./patches/force-cs-variant.patch
];
preBuild =
let
libPathsVar = if isDarwin then "DYLD_FALLBACK_LIBRARY_PATH" else "LD_LIBRARY_PATH";
in
/*
Makes FFIs available for setting up `main-distribution` and its
dependencies, which is integrated into the build process of Racket
*/
''
for lib_path in $( \
echo "$NIX_LDFLAGS" \
| tr ' ' '\n' \
| grep '^-L' \
| sed 's/^-L//' \
| awk '!seen[$0]++' \
); do
addToSearchPath ${libPathsVar} $lib_path
done
''
# Fixes Fontconfig errors
+ ''
export FONTCONFIG_FILE=${makeFontsConf { fontDirectories = [ ]; }}
export XDG_CACHE_HOME=$(mktemp -d)
'';
# Disable automatic wrapping, and only wrap the ELF binaries:
#
# - bin/racket
# - lib/racket/gracket
# - bin/mred
# - bin/mzscheme
#
# This avoids effectively double-wrapping shell scripts generated by raco, because they will
# call into the wrapped ELF binaries
dontWrapGApps = true;
preFixup = (lib.optionalString (!isDarwin) ''
gappsWrapperArgs+=("--set" "LOCALE_ARCHIVE" "${glibcLocales}/lib/locale/locale-archive")
'') + ''
wrapProgram $out/bin/racket "''${gappsWrapperArgs[@]}"
wrapProgram $out/bin/mred "''${gappsWrapperArgs[@]}"
wrapProgram $out/bin/mzscheme "''${gappsWrapperArgs[@]}"
wrapProgram $out/lib/racket/gracket "''${gappsWrapperArgs[@]}"
'';
passthru =
let
notUpdated = x: !builtins.isAttrs x || lib.isDerivation x;
stopPred =
_: lhs: rhs:
notUpdated lhs || notUpdated rhs;
in
lib.recursiveUpdateUntil stopPred prevAttrs.passthru {
tests = builtins.mapAttrs (name: path: callPackage path { racket = finalAttrs.finalPackage; }) {
## `main-distribution` ##
draw-crossing = ./tests/draw-crossing.nix;
};
};
meta = prevAttrs.meta // {
description = "Programmable programming language";
longDescription = ''
Racket is a full-spectrum programming language. It goes beyond
Lisp and Scheme with dialects that support objects, types,
laziness, and more. Racket enables programmers to link
components written in different dialects, and it empowers
programmers to create new, project-specific dialects. Racket's
libraries support applications from web servers and databases to
GUIs and charts.
'';
platforms = lib.platforms.unix;
badPlatforms = lib.platforms.darwin;
};
}
)

View File

@ -0,0 +1,12 @@
--- old/collects/setup/variant.rkt
+++ new/collects/setup/variant.rkt
@@ -7,7 +7,8 @@
(provide variant-suffix
script-variant?)
-(define plain-variant
+(define plain-variant 'cs)
+#;(define plain-variant
(delay/sync
(cond
[(cross-installation?)

View File

@ -0,0 +1,10 @@
--- old/src/mac/codesign.rkt
+++ new/src/mac/codesign.rkt
@@ -18,6 +18,6 @@
file))
(void
- (if remove?
+ (begin
(remove-signature file)
(add-ad-hoc-signature file)))

View File

@ -0,0 +1,18 @@
{ runCommandLocal, racket }:
runCommandLocal "racket-test-draw-crossing"
{
nativeBuildInputs = [ racket ];
}
''
racket -f - <<EOF
(require racket/draw)
(define target (make-bitmap 64 64))
(define dc (new bitmap-dc% [bitmap target]))
(send dc draw-line 0 0 64 64)
(send dc draw-line 0 64 64 0)
(send target save-file (getenv "out") 'png)
EOF
''

View File

@ -0,0 +1,45 @@
{
lib,
runCommandLocal,
racket,
}:
runCommandLocal "racket-test-get-version-and-variant"
{
nativeBuildInputs = [ racket ];
}
(
lib.concatLines (
builtins.map
(
{ expectation, output }:
''
expectation="${expectation}"
output="${output}"
if test "$output" != "$expectation"; then
echo "output mismatch: expected ''${expectation}, but got ''${output}"
exit 1
fi
''
)
[
{
expectation = racket.version;
output = "$(racket -e '(display (version))')";
}
{
expectation = "cs";
output = "$(racket -e '(require launcher/launcher) (display (current-launcher-variant))')";
}
{
expectation = "${lib.getExe racket}";
output = "$(racket -e '(require compiler/find-exe) (display (find-exe))')";
}
]
)
+ ''
touch $out
''
)

View File

@ -0,0 +1,15 @@
{ runCommandLocal, racket }:
runCommandLocal "racket-test-load-openssl"
{
nativeBuildInputs = [ racket ];
}
''
racket -f - <<EOF
(require openssl)
(unless ssl-available?
(raise ssl-load-fail-reason))
EOF
touch $out
''

View File

@ -0,0 +1,26 @@
{ runCommandLocal, racket }:
let
script = racket.writeScript "racket-test-nix-write-script-the-script" { } ''
#lang racket/base
(display "success")
(newline)
'';
in
runCommandLocal "racket-test-nix-write-script"
{
nativeBuildInputs = [ racket ];
}
''
expectation="success"
output="$(${script})"
if test "$output" != "$expectation"; then
echo "output mismatch: expected ''${expectation}, but got ''${output}"
exit 1
fi
touch $out
''

View File

@ -0,0 +1,23 @@
{ runCommandLocal, racket }:
runCommandLocal "racket-test-write-greeting"
{
nativeBuildInputs = [ racket ];
}
''
expectation="Hello, world!"
racket -f - <<EOF
(with-output-to-file (getenv "out")
(lambda ()
(display "Hello, world!")
(newline)))
EOF
output="$(cat $out)"
if test "$output" != "$expectation"; then
echo "output mismatch: expected ''${expectation}, but got ''${output}"
exit 1
fi
''

73
pkgs/racket/racket/update.py Executable file
View File

@ -0,0 +1,73 @@
#! /usr/bin/env nix-shell
#! nix-shell -i python3 --packages 'python3.withPackages (ps: with ps; [ requests beautifulsoup4 ])'
import os
import re
import json
import requests
from bs4 import BeautifulSoup
SITE = "https://download.racket-lang.org"
MANIFEST_FILENAME = "manifest.json"
def find_info(table, group_name, subgroup_name):
group = table.find(
string=re.compile("^{}\\s*".format(group_name))
).find_parent("tr", class_="group")
subgroup = group.find_next(
string=re.compile("^{}\\s*".format(subgroup_name))
).find_parent(class_="subgroup")
link = subgroup.find_next(
"a",
class_="installer",
string="Source"
)
filename = link["href"].split("/")[1]
sha256 = link.find_next(class_="checksum").string
return {
"filename": filename,
"sha256": sha256,
}
os.chdir(os.path.dirname(os.path.abspath(__file__)))
prev_version = os.environ["UPDATE_NIX_OLD_VERSION"]
homepage = BeautifulSoup(requests.get(SITE).text, "html.parser")
version = homepage.find(
"h3",
string=re.compile("^Version \\d+\\.\\d+")
).string.split()[1]
if version == prev_version:
raise Exception("no newer version available")
down_page_path = homepage.find(
"a",
string="More Installers and Checksums"
)["href"]
down_page = BeautifulSoup(requests.get(SITE + "/" + down_page_path).text, "html.parser")
down_table = down_page.find(class_="download-table")
full = find_info(down_table, "Racket", "Unix")
minimal = find_info(down_table, "Minimal Racket", "All Platforms")
with open(MANIFEST_FILENAME, "w", encoding="utf-8") as f:
json.dump({
"version": version,
"full": full,
"minimal": minimal,
}, f, indent=2, ensure_ascii=False)
f.write("\n")
print(json.dumps(
[
{
"attrPath": os.environ["UPDATE_NIX_ATTR_PATH"],
"oldVersion": prev_version,
"newVersion": version,
"files": [ os.path.abspath(MANIFEST_FILENAME) ],
},
],
indent=2, ensure_ascii=False
))