From 31e261a67af18d09bba1ea6b76e997ab25356aac Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:55:43 +0100 Subject: [PATCH] uiua: use finalAttrs pattern --- pkgs/by-name/ui/uiua/package.nix | 130 +++++++++++++++---------------- 1 file changed, 64 insertions(+), 66 deletions(-) diff --git a/pkgs/by-name/ui/uiua/package.nix b/pkgs/by-name/ui/uiua/package.nix index f9d5b3513ba3..c3de58883051 100644 --- a/pkgs/by-name/ui/uiua/package.nix +++ b/pkgs/by-name/ui/uiua/package.nix @@ -30,77 +30,75 @@ let .${uiua_versionType}; in -# buildRustPackage doesn't support finalAttrs, so we can't use finalPackage for the tests -lib.fix ( - uiua: - rustPlatform.buildRustPackage rec { - pname = "uiua"; - inherit (versionInfo) version cargoHash; - useFetchCargoVendor = true; +rustPlatform.buildRustPackage (finalAttrs: { + pname = "uiua"; + inherit (versionInfo) version cargoHash; + useFetchCargoVendor = true; - src = fetchFromGitHub { - owner = "uiua-lang"; - repo = "uiua"; - inherit (versionInfo) tag hash; - }; + src = fetchFromGitHub { + owner = "uiua-lang"; + repo = "uiua"; + inherit (versionInfo) tag hash; + }; - nativeBuildInputs = - lib.optionals (webcamSupport || stdenv.hostPlatform.isDarwin) [ rustPlatform.bindgenHook ] - ++ lib.optionals audioSupport [ pkg-config ]; + nativeBuildInputs = + lib.optionals (webcamSupport || stdenv.hostPlatform.isDarwin) [ rustPlatform.bindgenHook ] + ++ lib.optionals audioSupport [ pkg-config ]; - buildInputs = - [ libffi ] # we force dynamic linking our own libffi below - ++ lib.optionals (audioSupport && stdenv.hostPlatform.isLinux) [ alsa-lib ]; + buildInputs = + [ libffi ] # we force dynamic linking our own libffi below + ++ lib.optionals (audioSupport && stdenv.hostPlatform.isLinux) [ alsa-lib ]; - buildFeatures = - [ "libffi/system" ] # force libffi to be linked dynamically instead of rebuilding it - ++ lib.optional audioSupport "audio" - ++ lib.optional webcamSupport "webcam" - ++ lib.optional windowSupport "window"; + buildFeatures = + [ "libffi/system" ] # force libffi to be linked dynamically instead of rebuilding it + ++ lib.optional audioSupport "audio" + ++ lib.optional webcamSupport "webcam" + ++ lib.optional windowSupport "window"; - postFixup = - let - runtimeDependencies = lib.optionals windowSupport [ - libGL - libxkbcommon - wayland - xorg.libX11 - xorg.libXcursor - xorg.libXi - xorg.libXrandr - ]; - in - lib.optionalString (runtimeDependencies != [ ] && stdenv.hostPlatform.isLinux) '' - patchelf --add-rpath ${lib.makeLibraryPath runtimeDependencies} $out/bin/uiua - ''; - - nativeInstallCheckInputs = [ versionCheckHook ]; - versionCheckProgramArg = "--version"; - doInstallCheck = true; - - passthru.updateScript = versionInfo.updateScript; - passthru.tests.run = runCommand "uiua-test-run" { nativeBuildInputs = [ uiua ]; } '' - uiua init - diff -U3 --color=auto <(uiua run main.ua) <(echo '"Hello, World!"') - touch $out + postFixup = + let + runtimeDependencies = lib.optionals windowSupport [ + libGL + libxkbcommon + wayland + xorg.libX11 + xorg.libXcursor + xorg.libXi + xorg.libXrandr + ]; + in + lib.optionalString (runtimeDependencies != [ ] && stdenv.hostPlatform.isLinux) '' + patchelf --add-rpath ${lib.makeLibraryPath runtimeDependencies} $out/bin/uiua ''; - meta = { - changelog = "https://github.com/uiua-lang/uiua/blob/${src.rev}/changelog.md"; - description = "Stack-oriented array programming language with a focus on simplicity, beauty, and tacit code"; - longDescription = '' - Uiua combines the stack-oriented and array-oriented paradigms in a single - language. Combining these already terse paradigms results in code with a very - high information density and little syntactic noise. + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "--version"; + doInstallCheck = true; + + passthru.updateScript = versionInfo.updateScript; + passthru.tests.run = + runCommand "uiua-test-run" { nativeBuildInputs = [ finalAttrs.finalPackage ]; } + '' + uiua init + diff -U3 --color=auto <(uiua run main.ua) <(echo '"Hello, World!"') + touch $out ''; - homepage = "https://www.uiua.org/"; - license = lib.licenses.mit; - mainProgram = "uiua"; - maintainers = with lib.maintainers; [ - cafkafk - tomasajt - defelo - ]; - }; - } -) + + meta = { + changelog = "https://github.com/uiua-lang/uiua/blob/${finalAttrs.src.rev}/changelog.md"; + description = "Stack-oriented array programming language with a focus on simplicity, beauty, and tacit code"; + longDescription = '' + Uiua combines the stack-oriented and array-oriented paradigms in a single + 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 + ]; + }; +})