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

Updated nix overlay to support wayland and X11 at the same time (and remove eww-wayland overlay) #748

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Philipp-M
Copy link

@Philipp-M Philipp-M commented Apr 17, 2023

Description

Fixes #733

Since X11 and wayland is now supported at the same time, eww could be reduced to the same package eww.
Right now this builds with support for X11 and wayland (default features). It may make sense to add more fine-grained support for different features in upstream via parameters, when it is updated there (i.e. withWayland, withX11, for either X11 or wayland support or both at the same time (should probably be the default then)) .

@Philipp-M Philipp-M mentioned this pull request Apr 17, 2023
@adomixaszvers
Copy link

As of 82e13c1, it builds only with wayland feature so it opens as a regular window on x11.

@Philipp-M
Copy link
Author

Ah, yeah the common pitfalls of overwriting constructor functions (in this case buildRustPackage), I think now it should do the right thing.

@adomixaszvers
Copy link

It does not build with x11 feature.

$ nix build --no-link 'github:Philipp-M/eww/df6bed4d6aee994dac231a787b11fde900a2c486#eww'

$ nix log 'github:Philipp-M/eww/df6bed4d6aee994dac231a787b11fde900a2c486#eww' 

Cargo invokation was

env CC_x86_64-unknown-linux-gnu=/nix/store/3d9zjv5vaqjxb9kwbdqsd194alwm97x1-gcc-wrapper-11.3.0/bin/cc CXX_x86_64-unknown-linux-gnu=/nix/store/3d9zjv5vaqjxb9kwbdqsd194alwm97x1-gcc-wrapper-11.3.0/bin/c++ CC_x86_64-unknown-linux-gnu=/nix/store/3d9zjv5vaqjxb9kwbdqsd194alwm97x1-gcc-wrapper-11.3.0/bin/cc CXX_x86_64-unknown-linux-gnu=/nix/store/3d9zjv5vaqjxb9kwbdqsd194alwm97x1-gcc-wrapper-11.3.0/bin/c++ cargo build -j 8 --target x86_64-unknown-linux-gnu --frozen --release --features=wayland --bin eww

@Philipp-M
Copy link
Author

Are you sure, that it's not having the x11 feature? AFAIK features are additive as long as default features aren't explicitly disabled. So this should be equivalent to just (roughly) cargo build.

@adomixaszvers
Copy link

Oh, I didn't see you've enabled the default features. It seems fine.
image

I could close my PR #734 but what about the comment #734 (comment) ?

flake.nix Outdated
version = self.rev or "dirty";
src = builtins.path { name = "eww"; path = prev.lib.cleanSource ./.; };
cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
cargoBuildNoDefaultFeatures = false;

Choose a reason for hiding this comment

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

Double negative (cargoBuildNoDefaultFeatures and false) is confusing a bit.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah I also don't understand why the authors of buildRustPackage have chosen the naming of this...
But AFAIK it's the var that's necessary to use to enable/disable default features

Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably due to how cargo named it (cargo build --no-default-features)

@Philipp-M
Copy link
Author

As mentioned before, I would do these things/changes in the nixpkgs repo (add supportWayland and supportX11 to the derivation inputs of eww and set them to true by default, I don't think the extra dependency really hurts in X11 unless it really changes the behavior of eww. I think it's better to just support everything by default to avoid headaches.

So if a user really only wants X11 or wayland, the user has to explicitly disable the other features (i.e. stay close to the default features of eww).

I would update these things in nixpkgs when the next release of eww happens.

@eclairevoyant eclairevoyant mentioned this pull request Apr 29, 2023
11 tasks
@@ -6,7 +6,7 @@
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, nixpkgs, rust-overlay, flake-compat, ... }:
Copy link
Contributor

Choose a reason for hiding this comment

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

flake-compat is used in default.nix, revert this change

Copy link
Author

Choose a reason for hiding this comment

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

This should be a non issue though, as default.nix reads directly from the flake.lock and this is just a destructuring pattern of the function argument (flake-compat is not used anywhere in the flake.nix). I have not removed the flake input though (which AFAIK is the only necessary thing for an entry in the flake.lock).

@eclairevoyant
Copy link
Contributor

Was this tested (runtime)? I imagine #739 would cause problems and this change maybe doesn't make sense to merge as is (right now)

fwiw turning off default features and building with wayland does work regardless

@Philipp-M
Copy link
Author

You're correct just tested it in hyprland, seems like I forgot to test this properly with wayland, #739 seems to be an issue. Well than the question arises, if #739 should be fixed first, or I'm handling the cases differently (i.e. disable the x11 feature for wayland support). I believe fixing #739 would be better to be able to use one binary for all backends.

I think it makes sense to offer multiple flake outputs (eww-x11, eww-wayland and eww which supports both backends)

@eclairevoyant
Copy link
Contributor

I believe fixing #739 would be better to be able to use one binary for all backends.

Of course, I agree, my suggestion to build wayland binary without x11 support was just a workaround until #739 is addressed (if this PR were to be merged first). Other option would be to hold off on this PR for now

@Philipp-M
Copy link
Author

Since it's a simple change, I've updated the PR to support wayland separately (by implicitly disabling the feature x11 (done by nixpkgs upstream). That way it should be ready to merge anyways (the output eww just doesn't support wayland currently due to #739)

@adomixaszvers
Copy link

NixOS/nixpkgs#239826

@Philipp-M
Copy link
Author

Thanks for the info, I've updated the overlays accordingly (including necessarily the flake inputs).

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.

[BUG] Cannot build .#eww with Nix
4 participants