Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package request: gauntlet #364534

Open
qweered opened this issue Dec 12, 2024 · 12 comments · May be fixed by #371558
Open

Package request: gauntlet #364534

qweered opened this issue Dec 12, 2024 · 12 comments · May be fixed by #371558
Labels
0.kind: packaging request Request for a new package to be added

Comments

@qweered
Copy link

qweered commented Dec 12, 2024

Project description

Raycast-inspired open-source cross-platform application launcher with React-based plugins

Metadata


Note for maintainers: Please tag this issue in your PR.


Add a 👍 reaction to issues you find important.

@qweered qweered added the 0.kind: packaging request Request for a new package to be added label Dec 12, 2024
@genga898
Copy link
Contributor

{
  lib,
  callPackage,
  fetchFromGitHub,
  rustPlatform,
  fetchNpmDeps,
  cmake,
  pkg-config,
  libxkbcommon,
  protox,
  nodejs,
  openssl,
  librusty_v8 ? callPackage ./librusty_v8.nix {
    inherit (callPackage ./fetchers.nix { }) fetchLibrustyV8;
  },
}:

rustPlatform.buildRustPackage rec {
  pname = "gauntlet";
  version = "11";

  src = fetchFromGitHub {
    owner = "project-gauntlet";
    repo = "gauntlet";
    rev = "refs/tags/v${version}";
    hash = "sha256-lptkIUu0lutRGv1S16dPbQoQWyLlqUAfEhRJNJe57cY=";
  };

  npmDeps = fetchNpmDeps {
    name = "${pname}-${version}-npm-deps";
    inherit src;
    forceGitDeps = true;
    hash = "sha256-ZaVtPKunssM2PFgvy3dxZ5+RCWZGtVxVLXASJemFv50=";
  };

  useFetchCargoVendor = true;
  cargoHash = "sha256-BD2aLix7ndTK2M3FvGfzQp3Ec4FRy0aP4BmKl55IndU=";

  # The v8 package will try to download a `librusty_v8.a` release at build time to our read-only filesystem
  # To avoid this we pre-download the file and export it via RUSTY_V8_ARCHIVE
  env.RUSTY_V8_ARCHIVE = librusty_v8;

  nativeBuildInputs = [
    nodejs
    cmake
    pkg-config
    protox
  ];

  buildInputs = [
    libxkbcommon
    openssl
  ];
}

Got this far but I get an openssl error

@pluiedev
Copy link
Contributor

You might need to set env.OPENSSL_NO_VENDOR = true;

@genga898
Copy link
Contributor

You might need to set env.OPENSSL_NO_VENDOR = true;

Thanks, this helped though I have another error, seems like the server project fails to build with some errors, this is how far I've gotten with it so far

{
  lib,
  callPackage,
  fetchFromGitHub,
  rustPlatform,
  fetchNpmDeps,
  cmake,
  pkg-config,
  libxkbcommon,
  protobuf_29,
  nodejs,
  openssl,
  npmHooks,
  librusty_v8 ? callPackage ./librusty_v8.nix {
    inherit (callPackage ./fetchers.nix { }) fetchLibrustyV8;
  },
}:

rustPlatform.buildRustPackage rec {
  pname = "gauntlet";
  version = "11";

  src = fetchFromGitHub {
    owner = "project-gauntlet";
    repo = "gauntlet";
    rev = "refs/tags/v${version}";
    hash = "sha256-lptkIUu0lutRGv1S16dPbQoQWyLlqUAfEhRJNJe57cY=";
  };

  npmDeps = fetchNpmDeps {
    name = "${pname}-${version}-npm-deps";
    inherit src;
    forceGitDeps = true;
    hash = "sha256-ZaVtPKunssM2PFgvy3dxZ5+RCWZGtVxVLXASJemFv50=";
  };

  useFetchCargoVendor = true;
  cargoHash = "sha256-BD2aLix7ndTK2M3FvGfzQp3Ec4FRy0aP4BmKl55IndU=";

  # The v8 package will try to download a `librusty_v8.a` release at build time to our read-only filesystem
  # To avoid this we pre-download the file and export it via RUSTY_V8_ARCHIVE
  env.RUSTY_V8_ARCHIVE = librusty_v8;
  env.OPENSSL_NO_VENDOR = true;

  nativeBuildInputs = [
    nodejs
    cmake
    pkg-config
    protobuf_29
    npmHooks.npmConfigHook
  ];

  buildInputs = [
    libxkbcommon
    openssl
  ];
}

Error log

warning: `client` (lib) generated 34 warnings (run `cargo fix --lib -p client` to apply 23 suggestions)
error: couldn't read `/build/source/rust/server/../../js/react_renderer/dist/prod/renderer.js`: No such file or directory (os error 2)
   --> rust/server/src/plugins/js/mod.rs:415:32
    |
415 |     ("gauntlet:renderer:prod", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../js/react_renderer/dist/prod/renderer.js"))),
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read `/build/source/rust/server/../../js/react_renderer/dist/dev/renderer.js`: No such file or directory (os error 2)
   --> rust/server/src/plugins/js/mod.rs:416:31
    |
416 |     ("gauntlet:renderer:dev", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../js/react_renderer/dist/dev/renderer.js"))),
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read `/build/source/rust/server/../../js/react/dist/prod/react.production.min.js`: No such file or directory (os error 2)
   --> rust/server/src/plugins/js/mod.rs:417:29
    |
417 |     ("gauntlet:react:prod", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../js/react/dist/prod/react.production.min.js"))),
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read `/build/source/rust/server/../../js/react/dist/dev/react.development.js`: No such file or directory (os error 2)
   --> rust/server/src/plugins/js/mod.rs:418:28
    |
418 |     ("gauntlet:react:dev", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../js/react/dist/dev/react.development.js"))),
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read `/build/source/rust/server/../../js/react/dist/prod/react-jsx-runtime.production.min.js`: No such file or directory (os error 2)
   --> rust/server/src/plugins/js/mod.rs:419:41
    |
419 | ...me:prod", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../js/react/dist/prod/react-jsx-runtime.production.min.js"))),
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read `/build/source/rust/server/../../js/react/dist/dev/react-jsx-runtime.development.js`: No such file or directory (os error 2)
   --> rust/server/src/plugins/js/mod.rs:420:40
    |
420 | ...ntime:dev", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../js/react/dist/dev/react-jsx-runtime.development.js"))),
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read `/build/source/rust/server/../../js/core/dist/init.js`: No such file or directory (os error 2)
   --> rust/server/src/plugins/js/mod.rs:421:23
    |
421 |     ("gauntlet:core", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../js/core/dist/init.js"))),
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read `/build/source/rust/server/../../js/api/dist/gen/components.js`: No such file or directory (os error 2)
   --> rust/server/src/plugins/js/mod.rs:422:33
    |
422 |     ("gauntlet:api-components", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../js/api/dist/gen/components.js"))),
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read `/build/source/rust/server/../../js/api/dist/hooks.js`: No such file or directory (os error 2)
   --> rust/server/src/plugins/js/mod.rs:423:28
    |
423 |     ("gauntlet:api-hooks", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../js/api/dist/hooks.js"))),
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read `/build/source/rust/server/../../js/api/dist/helpers.js`: No such file or directory (os error 2)
   --> rust/server/src/plugins/js/mod.rs:424:30
    |
424 |     ("gauntlet:api-helpers", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../js/api/dist/helpers.js"))),
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: proc macro panicked
  --> rust/server/src/plugins/mod.rs:38:18
   |
38 |     ("gauntlet", include_dir!("$CARGO_MANIFEST_DIR/../../bundled_plugins/gauntlet/dist")),
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: message: "/build/source/rust/server/../../bundled_plugins/gauntlet/dist" is not a directory

@genga898
Copy link
Contributor

genga898 commented Dec 17, 2024

Seems like this is packaged but yet to be tested according to this pr project-gauntlet/gauntlet#27

@schradert
Copy link

schradert commented Dec 17, 2024

@genga898 I'm the author of that PR in the Gauntlet repo. It is working for me on x86_64-linux, aarch64-darwin, and aarch64-linux. Would be great if you could test it out to confirm on your systems! Also open to moving this into nixpkgs, but I was considering contributing to Gauntlet in other ways.

EDIT: Also, the caching from crane is quite nice

@schradert
Copy link

The PR has been merged into Gauntlet now. So what is the general approach to adding packages to nixpkgs that already have an official derivation upstream? I haven't contributed to nixpkgs before, but I don't think using nix is possible in the build phase and it seems like other packages just copy the code over.

@genga898
Copy link
Contributor

https://github.com/NixOS/nixpkgs/tree/master/doc Here's a link to the contributing guide

@genga898
Copy link
Contributor

@schradert I get this error continously when trying to add it through flakes

warning: Git tree '/home/genga/nix_config' is dirty
building the system configuration...
warning: Git tree '/home/genga/nix_config' is dirty
error (ignored): error: opening directory '"/tmp/nix-build-gauntlet-v11-npm-deps.drv-1"': Too many open files
error (ignored): error: opening directory '"/nix/store/dhxc4j1nmc6hm4yqv65hlxw4lq7kddnw-gauntlet-v11-npm-deps.drv.chroot"': Too many open files
error: opening directory '"/nix/store/dw0hnr2gsxgaasaf1pd3m81njvkz3wfb-ttf-parser-0.25.1"': Too many open files

Don't really know what the issue is.

@schradert
Copy link

schradert commented Dec 30, 2024

@genga898 Honestly I don't know. I didn't have that issue on any of my systems. I have encountered ulimit problems before with nix but they all required different fixes. Have you tried anything in #101459? Also I'll try to get the PR up here for Gauntlet in the next couple days.

@genga898
Copy link
Contributor

@genga898 Honestly I don't know. I didn't have that issue on any of my systems. I have encountered ulimit problems before with nix but they all required different fixes. Have you tried anything in #101459? Also I'll try to get the PR up here for Gauntlet in the next couple days.

Rebuild it again today with the latest commit and it was ok, took 2 and a half hours to fetch dependencies and build though

@schradert
Copy link

Glad it worked! It seemed quite bulky to me as well, but I have hardware that makes it take not even close to that long to build, so I brushed it off. I didn't notice much difference in speed between my original buildRustPackage implementation and the current one with crane when building with no cache. Maybe when I start the PR someone else will have suggestions on how to speed the build up.

@schradert schradert linked a pull request Jan 6, 2025 that will close this issue
13 tasks
@schradert
Copy link

I submitted a draft PR, but I haven't figured out a working solution that doesn't rely on crane or an unmerged fix of cargo vendoring tooling. You can see in the patch file that I tried patching the dpi duplicate source in crates.io to match the one specified in git, but that wasn't successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: packaging request Request for a new package to be added
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants