Javyre / swayfire

Sway/I3 inspired tiling window manager for Wayfire
GNU General Public License v3.0
172 stars 8 forks source link

build: don't use wayfire's pkgconfig metadata_dir var #45

Closed EzequielRamis closed 2 years ago

EzequielRamis commented 2 years ago

Hi! Before commenting about this PR, thank you for this nice plugin.

I've been trying NixOS with Wayfire and wanted to install a plugin outside of the default ones. The problem occurrs during the installation of the .xml metadata files because Nix won't let me doing it on the Wayfire's prefix. This PR has a more complete explanation and a half part of my solution.

Looking around other external plugins, I've found this commit by the same author of the mentioned PR and it clicked with me. So, I forked this repo, commited almost the same changes, set the WAYFIRE_PLUGIN_* env variables, and currently it works very well!

I've never used meson before, but I hope it's the solution I'm looking for.

Javyre commented 2 years ago

LGTM thanks!

fedoranvar commented 2 years ago

@EzequielRamis Can you please share your installation in NixOS?

EzequielRamis commented 2 years ago

@fedoranvar Sure! First, add this plugin as a derivation and call it:

{ pkgs, ... }:

pkgs.stdenv.mkDerivation rec {
  name = "swayfire";

  src = pkgs.fetchFromGitHub {
    owner = "Javyre";
    repo = name;
    rev = "master";
    sha256 = "1r05d2sqclq5kj0qkscp8q249kdwjjksi44vrl70gh23qf06b0yf";
  };

  nativeBuildInputs = with pkgs; [
    meson
    ninja
    pkg-config
    wayland
    cairo
    glm
    libinput
    libxkbcommon
    pango
  ];
  buildInputs = [ pkgs.wayfire ];

  mesonBuildType = "release";
}

Then in your system-wide configuration insert these env variables:

  environment.variables =
    let
      profileDir = "/nix/var/nix/profiles/per-user/${username}";
      homePath = profileDir + "/home-manager/home-path";
    in
    {
      WAYFIRE_PLUGIN_XML_PATH = "${homePath}/share/wayfire/metadata";
      WAYFIRE_PLUGIN_PATH = "${homePath}/lib/wayfire";
  };

If you are not using home-manager I think instead of using /nix/var/nix/profiles/per-user/${username}/home-manager/home-path you might have to use /nix/var/nix/profiles/system/sw.

fedoranvar commented 2 years ago

@EzequielRamis

Great! And two more questions, if you don't mind^

1) as swayfire is a plugin, then i need wayfire to be installed on my system?

2) I've declared custom packages of wayfire apps and i'm installingn them like that:

  environment.systemPackages = with pkgs; [
      (pkgs.callPackage ../../../pkgs/wayfire {
        meson = unstable.meson;
      })
      (pkgs.callPackage ../../../pkgs/wf-config { meson = unstable.meson; })
      (pkgs.callPackage ../../../pkgs/wf-shell { meson = unstable.meson; })
      (pkgs.callPackage ../../../pkgs/wcm {
        meson = unstable.meson;
        wf-shell = (pkgs.callPackage ../../../pkgs/wf-shell { meson = unstable.meson; });
      })
...
]

i want to make assignments for callPackage like:

let
wayfire = pkgs.callPackage...
in with pkgs;
[
wayfire
...
]

can you suggest something?

Thank you!

EzequielRamis commented 2 years ago
  1. The derivation I sent needs wayfire to compile, it's in buildInputs, so yeah! You can have it in environment.systemPackages; I do have it but I thinks it's redundant.

  2. I have a flake similar to this one to do this:

    home.packages = with pkgs; [
    wlr-randr
    wayfire
    my.wayfire-plugins.swayfire
    ];

    I suggest you to look at these lines and copy all the necessary modules. It's complicated but it's what it is.