From 2fbe36d497f043503100f2e6af2de57c02dbb4ac Mon Sep 17 00:00:00 2001 From: Jan-Bulthuis Date: Fri, 14 Nov 2025 14:32:38 +0100 Subject: [PATCH] featL Add helix and osc package --- packages/helix.nix | 82 +++++++++++++++++++++++++ packages/open-stage-control.nix | 104 ++++++++++++++++++++++++++++++++ 2 files changed, 186 insertions(+) create mode 100644 packages/helix.nix create mode 100644 packages/open-stage-control.nix diff --git a/packages/helix.nix b/packages/helix.nix new file mode 100644 index 0000000..adc97ba --- /dev/null +++ b/packages/helix.nix @@ -0,0 +1,82 @@ +{ + fetchFromGitHub, + fetchzip, + lib, + rustPlatform, + git, + installShellFiles, + versionCheckHook, + nix-update-script, +}: + +rustPlatform.buildRustPackage (final: rec { + pname = "helix"; + version = "25.07.1"; + + # This release tarball includes source code for the tree-sitter grammars, + # which is not ordinarily part of the repository. + src = fetchFromGitHub { + owner = "helix-editor"; + repo = "helix"; + rev = "109c812233e442addccf1739dec4406248bd3244"; + hash = "sha256-c3fpREWUKGonlmV/aesmyRxbJZQypHgXStR7SwdcCo0="; + }; + grammars = fetchzip { + url = "https://github.com/helix-editor/helix/releases/download/${final.version}/helix-${final.version}-source.tar.xz"; + hash = "sha256-Pj/lfcQXRWqBOTTWt6+Gk61F9F1UmeCYr+26hGdG974="; + stripRoot = false; + }; + + cargoHash = "sha256-g5MfCedLBiz41HMkIHl9NLWiewE8t3H2iRKOuWBmRig="; + + nativeBuildInputs = [ + git + installShellFiles + ]; + + env.HELIX_DEFAULT_RUNTIME = "${placeholder "out"}/lib/runtime"; + + patchPhase = '' + # Add the runtime data + rm -r runtime + cp ${grammars}/languages.toml languages.toml + cp -r ${grammars}/runtime runtime + chmod -R u+w runtime + ''; + + postInstall = '' + # not needed at runtime + rm -r runtime/grammars/sources + + mkdir -p $out/lib + cp -r runtime $out/lib + installShellCompletion contrib/completion/hx.{bash,fish,zsh} + mkdir -p $out/share/{applications,icons/hicolor/256x256/apps} + cp contrib/Helix.desktop $out/share/applications + cp contrib/helix.png $out/share/icons/hicolor/256x256/apps + ''; + + nativeInstallCheckInputs = [ + versionCheckHook + ]; + versionCheckProgram = "${placeholder "out"}/bin/hx"; + versionCheckProgramArg = "--version"; + doInstallCheck = true; + + passthru = { + updateScript = nix-update-script { }; + }; + + meta = { + description = "Post-modern modal text editor"; + homepage = "https://helix-editor.com"; + changelog = "https://github.com/helix-editor/helix/blob/${final.version}/CHANGELOG.md"; + license = lib.licenses.mpl20; + mainProgram = "hx"; + maintainers = with lib.maintainers; [ + danth + yusdacra + zowoq + ]; + }; +}) diff --git a/packages/open-stage-control.nix b/packages/open-stage-control.nix new file mode 100644 index 0000000..b556ad3 --- /dev/null +++ b/packages/open-stage-control.nix @@ -0,0 +1,104 @@ +{ + lib, + buildNpmPackage, + fetchFromGitHub, + makeBinaryWrapper, + makeDesktopItem, + copyDesktopItems, + nodejs_20, + electron, + python3, + nix-update-script, +}: + +buildNpmPackage rec { + pname = "open-stage-control"; + version = "1.29.8"; + + src = fetchFromGitHub { + owner = "jean-emmanuel"; + repo = "open-stage-control"; + rev = "v${version}"; + hash = "sha256-518KXvNffLOV2aIWlLJcnPzxEbWxYdjWeiDBC1jlecQ="; + }; + + # Remove some Electron stuff from package.json + postPatch = '' + sed -i -e '/"electron"\|"electron-installer-debian"/d' package.json + ''; + + npmDepsHash = "sha256-U4zwYL5URNW0y0W4WvWAVL0hubiiU+2z9F5mDE9l8UU="; + + nodejs = nodejs_20; + + nativeBuildInputs = [ + copyDesktopItems + makeBinaryWrapper + ]; + + buildInputs = [ + python3.pkgs.python-rtmidi + ]; + + doInstallCheck = true; + + makeCacheWritable = true; + npmFlags = [ + "--legacy-peer-deps" + "--skip-pkg" + ]; + + # Override installPhase so we can copy the only directory that matters (app) + installPhase = '' + runHook preInstall + + # copy built app and node_modules directories + mkdir -p $out/lib/node_modules/open-stage-control + cp -r app $out/lib/node_modules/open-stage-control/ + + # copy icon + install -Dm644 resources/images/logo.png $out/share/icons/hicolor/256x256/apps/open-stage-control.png + install -Dm644 resources/images/logo.svg $out/share/icons/hicolor/scalable/apps/open-stage-control.svg + + # wrap electron and include python-rtmidi + makeWrapper '${electron}/bin/electron' $out/bin/open-stage-control \ + --inherit-argv0 \ + --add-flags $out/lib/node_modules/open-stage-control/app \ + --prefix PYTHONPATH : "$PYTHONPATH" \ + --prefix PATH : '${lib.makeBinPath [ python3 ]}' + + runHook postInstall + ''; + + installCheckPhase = '' + XDG_CONFIG_HOME="$(mktemp -d)" $out/bin/open-stage-control --help + ''; + + desktopItems = [ + (makeDesktopItem { + name = "open-stage-control"; + exec = "open-stage-control"; + icon = "open-stage-control"; + desktopName = "Open Stage Control"; + comment = meta.description; + categories = [ + "Network" + "Audio" + "AudioVideo" + "Midi" + ]; + startupWMClass = "open-stage-control"; + }) + ]; + + passthru.updateScript = nix-update-script { }; + + meta = with lib; { + description = "Libre and modular OSC / MIDI controller"; + homepage = "https://openstagecontrol.ammd.net/"; + license = licenses.gpl3Only; + maintainers = [ ]; + platforms = platforms.linux; + mainProgram = "open-stage-control"; + }; +}