Unverified Commit f4f322d1 authored by Masum Reza's avatar Masum Reza Committed by GitHub
Browse files

Merge pull request #330245 from JohnRTitor/uwsm

uwsm: 0.17.0 -> 0.17.2, fix paths and deps by wrapping the binaries
parents 94e9e1ce 2c60d671
Loading
Loading
Loading
Loading
+47 −8
Original line number Diff line number Diff line
@@ -2,18 +2,25 @@
  stdenv,
  lib,
  fetchFromGitHub,
  makeBinaryWrapper,
  meson,
  ninja,
  scdoc,
  pkg-config,
  nix-update-script,
  bash,
  dmenu,
  libnotify,
  newt,
  python3Packages,
  util-linux,
  hyprland,
  sway,
  fumonSupport ? true,
  uuctlSupport ? true,
  uwsmAppSupport ? true,
  hyprlandSupport ? false,
  swaySupport ? false,
}:
let
  python = python3Packages.python.withPackages (ps: [
@@ -24,29 +31,31 @@ let
in
stdenv.mkDerivation (finalAttrs: {
  pname = "uwsm";
  version = "0.17.0";
  version = "0.17.2";

  src = fetchFromGitHub {
    owner = "Vladimir-csp";
    repo = "uwsm";
    rev = "refs/tags/v${finalAttrs.version}";
    hash = "sha256-M2j7l5XTSS2IzaJofAHct1tuAO2A9Ps9mCgAWKEvzoE=";
    hash = "sha256-7RPz0VOUJ4fFhxNq+/s+/YEvy03XXgssggPn/JtOZI4=";
  };

  nativeBuildInputs = [
    makeBinaryWrapper
    meson
    ninja
    pkg-config
    scdoc
  ];

  buildInputs = [
    libnotify
    util-linux
  propagatedBuildInputs = [
    util-linux # waitpid
    newt # whiptail
    libnotify # notify
    bash # sh
    python
  ] ++ (lib.optionals uuctlSupport [ dmenu ]);

  propagatedBuildInputs = [ python ];

  mesonFlags = [
    "--prefix=${placeholder "out"}"
    (lib.mapAttrsToList lib.mesonEnable {
@@ -61,11 +70,41 @@ stdenv.mkDerivation (finalAttrs: {
    updateScript = nix-update-script { };
  };

  postInstall =
    let
      wrapperArgs = ''
        --prefix PATH : "${lib.makeBinPath finalAttrs.propagatedBuildInputs}" \
        --suffix PATH : "${
          lib.makeBinPath (
            # uwsm as of 0.17.2 can load WMs like sway and hyprland by path
            # but this is still needed as a fallback
            lib.optionals hyprlandSupport [ hyprland ] ++ lib.optionals swaySupport [ sway ]
          )
        }"
      '';
    in
    ''
      wrapProgram $out/bin/uwsm ${wrapperArgs}
      ${lib.optionalString uuctlSupport ''
        wrapProgram $out/bin/uuctl ${wrapperArgs}
      ''}
      ${lib.optionalString uwsmAppSupport ''
        wrapProgram $out/bin/uwsm-app ${wrapperArgs}
      ''}
      ${lib.optionalString fumonSupport ''
        wrapProgram $out/bin/fumon ${wrapperArgs}
      ''}
    '';

  meta = {
    description = "Universal wayland session manager";
    homepage = "https://github.com/Vladimir-csp/uwsm";
    mainProgram = "uwsm";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ johnrtitor ];
    maintainers = with lib.maintainers; [
      johnrtitor
      kai-tub
    ];
    platforms = lib.platforms.linux;
  };
})