uiua{,-unstable}: use lib.fix to reference self, rename unstable flag to uiua_versionType (#365712)

This commit is contained in:
Christina Sørensen
2024-12-18 05:47:57 +01:00
committed by GitHub
2 changed files with 55 additions and 47 deletions
+54 -46
View File
@@ -1,4 +1,6 @@
{ {
uiua_versionType ? "stable",
lib, lib,
stdenv, stdenv,
rustPlatform, rustPlatform,
@@ -10,61 +12,67 @@
alsa-lib, alsa-lib,
webcamSupport ? false, webcamSupport ? false,
# passthru.tests.run
runCommand, runCommand,
uiua,
unstable ? false,
}: }:
let let
versionInfo = import (if unstable then ./unstable.nix else ./stable.nix); versionInfo =
{
"stable" = import ./stable.nix;
"unstable" = import ./unstable.nix;
}
.${uiua_versionType};
in in
rustPlatform.buildRustPackage rec {
pname = "uiua";
inherit (versionInfo) version cargoHash;
src = fetchFromGitHub { # buildRustPackage doesn't support finalAttrs, so we can't use finalPackage for the tests
owner = "uiua-lang"; lib.fix (
repo = "uiua"; uiua:
inherit (versionInfo) rev hash; rustPlatform.buildRustPackage rec {
}; pname = "uiua";
inherit (versionInfo) version cargoHash;
nativeBuildInputs = src = fetchFromGitHub {
lib.optionals (webcamSupport || stdenv.hostPlatform.isDarwin) [ rustPlatform.bindgenHook ] owner = "uiua-lang";
++ lib.optionals audioSupport [ pkg-config ]; repo = "uiua";
inherit (versionInfo) rev hash;
};
buildInputs = nativeBuildInputs =
[ libffi ] # we force dynamic linking our own libffi below lib.optionals (webcamSupport || stdenv.hostPlatform.isDarwin) [ rustPlatform.bindgenHook ]
++ lib.optionals (audioSupport && stdenv.hostPlatform.isLinux) [ alsa-lib ]; ++ lib.optionals audioSupport [ pkg-config ];
buildFeatures = buildInputs =
[ "libffi/system" ] # force libffi to be linked dynamically instead of rebuilding it [ libffi ] # we force dynamic linking our own libffi below
++ lib.optional audioSupport "audio" ++ lib.optionals (audioSupport && stdenv.hostPlatform.isLinux) [ alsa-lib ];
++ lib.optional webcamSupport "webcam";
passthru.updateScript = versionInfo.updateScript; buildFeatures =
passthru.tests.run = runCommand "uiua-test-run" { nativeBuildInputs = [ uiua ]; } '' [ "libffi/system" ] # force libffi to be linked dynamically instead of rebuilding it
uiua init ++ lib.optional audioSupport "audio"
diff -U3 --color=auto <(uiua run main.ua) <(echo '"Hello, World!"') ++ lib.optional webcamSupport "webcam";
touch $out
'';
meta = { passthru.updateScript = versionInfo.updateScript;
changelog = "https://github.com/uiua-lang/uiua/blob/${src.rev}/changelog.md"; passthru.tests.run = runCommand "uiua-test-run" { nativeBuildInputs = [ uiua ]; } ''
description = "Stack-oriented array programming language with a focus on simplicity, beauty, and tacit code"; uiua init
longDescription = '' diff -U3 --color=auto <(uiua run main.ua) <(echo '"Hello, World!"')
Uiua combines the stack-oriented and array-oriented paradigms in a single touch $out
language. Combining these already terse paradigms results in code with a very
high information density and little syntactic noise.
''; '';
homepage = "https://www.uiua.org/";
license = lib.licenses.mit; meta = {
mainProgram = "uiua"; changelog = "https://github.com/uiua-lang/uiua/blob/${src.rev}/changelog.md";
maintainers = with lib.maintainers; [ description = "Stack-oriented array programming language with a focus on simplicity, beauty, and tacit code";
cafkafk longDescription = ''
tomasajt Uiua combines the stack-oriented and array-oriented paradigms in a single
defelo language. Combining these already terse paradigms results in code with a very
]; high information density and little syntactic noise.
}; '';
} homepage = "https://www.uiua.org/";
license = lib.licenses.mit;
mainProgram = "uiua";
maintainers = with lib.maintainers; [
cafkafk
tomasajt
defelo
];
};
}
)
+1 -1
View File
@@ -7090,7 +7090,7 @@ with pkgs;
babashka-unwrapped = callPackage ../development/interpreters/babashka { }; babashka-unwrapped = callPackage ../development/interpreters/babashka { };
babashka = callPackage ../development/interpreters/babashka/wrapped.nix { }; babashka = callPackage ../development/interpreters/babashka/wrapped.nix { };
uiua-unstable = callPackage ../by-name/ui/uiua/package.nix { unstable = true; }; uiua-unstable = callPackage ../by-name/ui/uiua/package.nix { uiua_versionType = "unstable"; };
# BQN interpreters and compilers # BQN interpreters and compilers