Skip to content

Commit

Permalink
uiua{,-unstable}: add windowSupport option and refactor (#371040)
Browse files Browse the repository at this point in the history
  • Loading branch information
cafkafk authored Jan 6, 2025
2 parents 3df3c47 + e75958d commit 8ab83a2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
31 changes: 29 additions & 2 deletions pkgs/by-name/ui/uiua/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
rustPlatform,
fetchFromGitHub,
pkg-config,
versionCheckHook,

libffi,
audioSupport ? true,
alsa-lib,
webcamSupport ? false,
libGL,
libxkbcommon,
wayland,
xorg,
windowSupport ? false,

runCommand,
}:
Expand All @@ -34,7 +40,7 @@ lib.fix (
src = fetchFromGitHub {
owner = "uiua-lang";
repo = "uiua";
inherit (versionInfo) rev hash;
inherit (versionInfo) tag hash;
};

nativeBuildInputs =
Expand All @@ -48,7 +54,28 @@ lib.fix (
buildFeatures =
[ "libffi/system" ] # force libffi to be linked dynamically instead of rebuilding it
++ lib.optional audioSupport "audio"
++ lib.optional webcamSupport "webcam";
++ 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 ]; } ''
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ui/uiua/stable.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
rec {
version = "0.14.1";
rev = version;
tag = version;
hash = "sha256-+FiJYxB2Lb1B7l9QEuB/XzdEYgJZmYAQpKimRIhWwhc=";
cargoHash = "sha256-0ZK87aX3akEPEXIsFrbOvTfhW24TZCuCcSVp+j8ylyg=";
updateScript = ./update-stable.sh;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ui/uiua/unstable.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
rec {
version = "0.14.1";
rev = version;
tag = version;
hash = "sha256-+FiJYxB2Lb1B7l9QEuB/XzdEYgJZmYAQpKimRIhWwhc=";
cargoHash = "sha256-0ZK87aX3akEPEXIsFrbOvTfhW24TZCuCcSVp+j8ylyg=";
updateScript = ./update-unstable.sh;
Expand Down

0 comments on commit 8ab83a2

Please sign in to comment.