DMaroo / fakwin

Fake KWin DBus service to make KDE 6 play nice with i3wm
MIT License
13 stars 0 forks source link

Nix `home-manager` integration #3

Open mghesh-yseop opened 2 months ago

mghesh-yseop commented 2 months ago

!! This is not a real issue

Thanks for the package, which solves my issue on my Nixos installation, where I run Plasma6 with i3.

So here is my home-manager configuration, which builds your package, and creates a user systemd service.

{ config, lib, pkgs, ... }:

# Example: https://github.com/nix-community/home-manager/blob/master/modules/services/window-managers/i3-sway/i3.nix

let
  fakwin = pkgs.stdenv.mkDerivation rec {
    pname = "fakwin";
    version = "1.0.0";

    src = pkgs.fetchFromGitHub {
      owner = "DMaroo";
      repo = "fakwin";
      rev = "master";
      hash = "sha256-oEMSuy2NMbd3Q7wtGSVz9vrqNWFeZLrNDM3KAsLgUOw=";
    };

    nativeBuildInputs = [ pkgs.cmake pkgs.qt6.wrapQtAppsHook ];

    buildInputs = [ pkgs.qt6.qtbase ];

    installPhase = ''
      mkdir -p $out/bin
      cp fakwin $out/bin/
    '';

    meta = with pkgs.lib; {
      description = "A fake KWin dbus interface for Plasma6 running without KWin";
      license = licenses.mit;
      maintainers = with maintainers; [ "DMaroo" ];
      platforms = platforms.linux;
    };
  };

in
{
  home.packages = [ fakwin ];

  systemd.user.services."fakwin" = {
    Unit = {
      Description = "Plasma Fake KWin dbus interface";
      After = [ "multi-user.target" ];
    };
    Install = {
      WantedBy = [ "default.target" ];
    };
    Service = {
      ExecStart = "${fakwin}/bin/fakwin";
      Slice = "session.slice";
      Restart = "on-failure";
    };
  };

  home.activation = {
    ensureFakwinActive = lib.hm.dag.entryAfter ["writeBoundary"] ''
      ${pkgs.systemd}/bin/systemctl --user enable fakwin.service
    '';
  };
}

I just wanted to share this, but I didn't know where.

DMaroo commented 2 months ago

Pinning this, thanks for opening the issue!