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

fix: flake.nix under NixOS #810

Merged
merged 4 commits into from
Sep 18, 2024
Merged

fix: flake.nix under NixOS #810

merged 4 commits into from
Sep 18, 2024

Conversation

dvtfl
Copy link
Contributor

@dvtfl dvtfl commented Sep 4, 2024

There are multiple issues with flake.nix.

  1. rust-src is missing in rust-toolchain.toml.
    Because of that, Rust Analyzer fails to resolve std, rendering RA pretty much unusable.

(Zed log)

[WARN  project] Language server rust-analyzer-2024-09-02 (id 1) status update: Workspace `~/cosmic/cosmic-comp/Cargo.toml` has sysroot errors: can't load standard library from sysroot
{sysroot_path}
(discovered via `rustc --print sysroot`)
try installing the Rust source the same way you installed rustc

image
flake.nix imports rust toolchain from it:

rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;

  1. When running in Wayland session in NixOS, cosmic-comp fails since libwayland-egl.so is missing in runtime.
2024-09-04T12:46:55.406051Z ERROR backend_winit: panic: thread 'main' panicked at 'Library libwayland-egl.so could not be loaded.': /home/dvtfl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wayland-sys-0.31.4/src/egl.rs:46
<...>
  26: smithay::backend::winit::init
             at /home/dvtfl/.cargo/git/checkouts/smithay-0141b1fcb9e16729/65c4abf/src/backend/winit/mod.rs:71:5
  27: cosmic_comp::backend::winit::init_backend
             at /home/dvtfl/projects/rust/cosmic/cosmic-comp/src/backend/winit.rs:132:9
  28: cosmic_comp::backend::init_backend_auto
             at /home/dvtfl/projects/rust/cosmic/cosmic-comp/src/backend/mod.rs:35:25
  29: cosmic_comp::main
             at /home/dvtfl/projects/rust/cosmic/cosmic-comp/src/main.rs:108:
<...>

full backtrace
3. When running in X11 session in NixOS, cosmic-comp fails since it fails to instantiate Vulkan and GBM.

INFO cosmic_comp::backend::x11: EGL hardware-acceleration enabled.
WARN cosmic_comp::backend::x11: Failed to instanciate vulkan, falling back to gbm allocator. err=Load(LoadError)
INFO smithay::backend::drm::device::fd: Dropping device: Some("/dev/dri/renderD128")
ERROR cosmic_comp::backend::x11: Failed to create GBM device. err=Os { code: 2, kind: NotFound, message: "No such file or directory" }
WARN cosmic_comp::backend: Initializing X11 Backend failed. err=Failed to create allocator for x11
INFO cosmic_comp::backend: Falling back to winit backend.
INFO backend_winit: smithay::backend::winit: Initializing a winit backend
Error: Failed to initilize winit backend: EventLoopCreation(NotSupported(NotSupportedError))

This PR addresses issues above and additionally reformats flake.nix using nixfmt-rfc-style.

On NixOS, when entering the devshell, Rust Analyzer couldn't locate `std` (sysroot) since it was missing.
fixes 'libwayland-egl.so could not be loaded' and 'Initializing X11 Backend failed' on NixOS.
crane does not have inputs at all.
@dvtfl dvtfl force-pushed the nixos-fixes branch 3 times, most recently from 272d566 to 9a760bd Compare September 4, 2024 18:35
Copy link
Member

@Drakulix Drakulix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@Drakulix Drakulix merged commit 7c24e36 into pop-os:master Sep 18, 2024
2 checks passed
@dvtfl
Copy link
Contributor Author

dvtfl commented Sep 19, 2024

feel free to mention me with Nix related issues :)

@dvtfl dvtfl deleted the nixos-fixes branch September 19, 2024 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants