NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.75k stars 13.87k forks source link

Package request: gg #299856

Open colemickens opened 6 months ago

colemickens commented 6 months ago

Project description

gg is a GUI for jj users. It is a Tauri app.

I believe that @Khionu is working on some stuff to assist packaging Tauri apps in nixpkgs. I wanted to open a 'tracking' issue, maybe to coordinate efforts and keep an eye on things, rather than constantly bugging them in the JJ Discord.

(jj is awesome, if you're reading this, you might find it neat to checkout!)

Metadata


Add a :+1: reaction to issues you find important.

chewblacka commented 6 months ago

New version 0.16.0 has just come out. But my build still fails with:

error: failed to run custom build command for `jj-cli v0.16.0`

Caused by:
  process didn't exit successfully: `/build/source/src-tauri/target/release/build/jj-cli-28b6a5107c2375a4/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at /build/cargo-vendor-dir/jj-cli-0.16.0/build.rs:30:10:
  called `Result::unwrap()` on an `Err` value: CargoMetadata { stderr: "error: failed to get `chrono` as a dependency of package `jj-cli v0.16.0 (/build/cargo-vendor-dir/jj-cli-0.16.0)`
Caused by:  failed to load source for dependency `chrono`
Caused by: Unable to update registry `crates-io`
Caused by: failed to update replaced source registry `crates-io`
Caused by: failed to read root of directory source: /build/cargo-vendor-dir/cargo-vendor-dir
Caused by: No such file or directory (os error 2)

Anyone got any ideas?

scoiatael commented 6 months ago

I ran into similar problem when trying to add build gg using buildRustPackage.

FWIW I believe problem is in the duplicate cargo-vendor-dir (i.e. /build/cargo-vendor-dir/ is a valid directory, /build/cargo-vendor-dir/cargo-vendor-dir is not).

This is caused by paths in cargo config being relative to config itself (https://doc.rust-lang.org/cargo/reference/config.html#config-relative-paths).

Temporary fix is to patch directory in .cargo/config with an absolute path, but a long-term solution would be to fix https://github.com/NixOS/nixpkgs/blob/7f13fd4e7960fe2cefaba1048ea1885014311635/pkgs/build-support/rust/import-cargo-lock.nix#L234


(Incomplete) solution can be found at https://github.com/scoiatael/dotfiles/blob/master/packages/gg/default.nix - I'm right now stuck at building frontend part, due to problems with rollup missing its native dependencies:

Executing npmBuildHook

> gg@0.15.3 build
> vite build

/private/tmp/nix-build-gg-ui-unstable-0.15.3.drv-22/source/node_modules/rollup/dist/native.js:87
                throw new Error(
                      ^

Error: Cannot find module @rollup/rollup-darwin-arm64. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.

which I believe is tracked here.

scoiatael commented 6 months ago

Update: I have a working build for 0.15.3 in https://github.com/scoiatael/dotfiles/blob/d5b31462aa930e0d337b80a8aa69382f2496e884/packages/gg/default.nix if anyone needs inspiration.

Unfortunately it took some tweaking of package-lock.json by hand to make it build and so it probably won't work on anything other than darwin-arm64. Probably next step would be to stop using fetchNpmDeps and instead let npm correctly resolve all the dependencies by itself.

jcollie commented 1 month ago

@scoiatael any chance for an update to 0.20.0?

scoiatael commented 3 weeks ago

@jcollie done: https://github.com/scoiatael/dotfiles/blob/0963b3428506092ad9a6c1725eb87d136f0fca98/packages/gg/default.nix

notes: