From 176f59f3bdf481c423883eac8fdfc0199d4c9167 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Fri, 9 Jun 2023 08:12:07 -0400 Subject: [PATCH] meta: Replace rofi package with overlay This significantly reduces the complexity of maintaining a more recent version of rofi-wayland. --- modules/rofi/default.nix | 11 +----- overlays/default.nix | 1 + overlays/rofi/default.nix | 20 +++++++++++ packages/rofi/default.nix | 71 --------------------------------------- packages/rofi/wayland.nix | 32 ------------------ packages/rofi/wrapper.nix | 56 ------------------------------ 6 files changed, 22 insertions(+), 169 deletions(-) create mode 100644 overlays/rofi/default.nix delete mode 100644 packages/rofi/default.nix delete mode 100644 packages/rofi/wayland.nix delete mode 100644 packages/rofi/wrapper.nix diff --git a/modules/rofi/default.nix b/modules/rofi/default.nix index ab081429..c1f7f0ff 100644 --- a/modules/rofi/default.nix +++ b/modules/rofi/default.nix @@ -1,17 +1,8 @@ -{ - pkgs, - lib, - ... -}: { +{lib, ...}: { home-manager.sharedModules = [ { programs.rofi = { enable = true; - - package = pkgs.callPackage ../../packages/rofi/wrapper.nix { - rofi-unwrapped = pkgs.callPackage ../../packages/rofi/wayland.nix {}; - }; - cycle = false; extraConfig = { diff --git a/overlays/default.nix b/overlays/default.nix index 7e81b10b..d41190cf 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -2,5 +2,6 @@ imports = [ ./alejandra ./joshuto + ./rofi ]; } diff --git a/overlays/rofi/default.nix b/overlays/rofi/default.nix new file mode 100644 index 00000000..1420bbf8 --- /dev/null +++ b/overlays/rofi/default.nix @@ -0,0 +1,20 @@ +{pkgs, ...}: { + nixpkgs.overlays = [ + (final: prev: { + rofi-unwrapped = prev.rofi-unwrapped.overrideAttrs (oldAttrs: rec { + version = "d06095b5ed40e5d28236b7b7b575ca867696d847"; + + src = final.fetchFromGitHub { + owner = "lbonn"; + repo = "rofi"; + rev = version; + fetchSubmodules = true; + sha256 = "sha256-8IfHpaVFGeWqyw+tLjNtg+aWwAHhSA5PuXJYjpoht2E="; + }; + + nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [pkgs.wayland-scanner]; + buildInputs = oldAttrs.buildInputs ++ [pkgs.wayland pkgs.wayland-protocols]; + }); + }) + ]; +} diff --git a/packages/rofi/default.nix b/packages/rofi/default.nix deleted file mode 100644 index a28ab1e6..00000000 --- a/packages/rofi/default.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ - stdenv, - lib, - fetchFromGitHub, - meson, - ninja, - pkg-config, - libxkbcommon, - pango, - which, - git, - cairo, - libxcb, - xcbutil, - xcbutilwm, - xcbutilxrm, - xcb-util-cursor, - libstartup_notification, - bison, - flex, - librsvg, - check, - glib, - buildPackages, -}: -stdenv.mkDerivation rec { - pname = "rofi-unwrapped"; - version = "1.7.5"; - - src = fetchFromGitHub { - owner = "davatorium"; - repo = "rofi"; - rev = version; - fetchSubmodules = true; - sha256 = "sha256-3XFusKeckagEPfbLtt1xAVTEfn1Qebdi/Iq1AYbHCR4="; - }; - - preConfigure = '' - patchShebangs "script" - # root not present in build /etc/passwd - sed -i 's/~root/~nobody/g' test/helper-expand.c - ''; - - depsBuildBuild = [buildPackages.stdenv.cc pkg-config glib]; - nativeBuildInputs = [meson ninja pkg-config flex bison]; - buildInputs = [ - libxkbcommon - pango - cairo - git - librsvg - check - libstartup_notification - libxcb - xcbutil - xcbutilwm - xcbutilxrm - xcb-util-cursor - which - ]; - - doCheck = false; - - meta = with lib; { - description = "Window switcher, run dialog and dmenu replacement"; - homepage = "https://github.com/davatorium/rofi"; - license = licenses.mit; - maintainers = with maintainers; [bew]; - platforms = with platforms; linux; - }; -} diff --git a/packages/rofi/wayland.nix b/packages/rofi/wayland.nix deleted file mode 100644 index 14a41729..00000000 --- a/packages/rofi/wayland.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - stdenv, - lib, - fetchFromGitHub, - rofi-unwrapped, - wayland-scanner, - wayland-protocols, - wayland, -}: -rofi-unwrapped.overrideAttrs (oldAttrs: rec { - pname = "rofi-wayland-unwrapped"; - version = "git"; - - src = fetchFromGitHub { - owner = "lbonn"; - repo = "rofi"; - rev = "d06095b5ed40e5d28236b7b7b575ca867696d847"; - fetchSubmodules = true; - sha256 = "sha256-8IfHpaVFGeWqyw+tLjNtg+aWwAHhSA5PuXJYjpoht2E="; - }; - - nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [wayland-scanner]; - buildInputs = oldAttrs.buildInputs ++ [wayland wayland-protocols]; - - meta = with lib; { - description = "Window switcher, run dialog and dmenu replacement for Wayland"; - homepage = "https://github.com/lbonn/rofi"; - license = licenses.mit; - maintainers = with maintainers; [bew]; - platforms = with platforms; linux; - }; -}) diff --git a/packages/rofi/wrapper.nix b/packages/rofi/wrapper.nix deleted file mode 100644 index a6a3c96a..00000000 --- a/packages/rofi/wrapper.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ - symlinkJoin, - lib, - rofi-unwrapped, - makeWrapper, - wrapGAppsHook, - gdk-pixbuf, - hicolor-icon-theme, - theme ? null, - plugins ? [], - symlink-dmenu ? false, -}: -symlinkJoin { - name = "rofi-${rofi-unwrapped.version}"; - - paths = - [ - rofi-unwrapped.out - ] - ++ (lib.forEach plugins (p: p.out)); - - nativeBuildInputs = [makeWrapper wrapGAppsHook]; - buildInputs = [gdk-pixbuf]; - - preferLocalBuild = true; - passthru.unwrapped = rofi-unwrapped; - - dontWrapGApps = true; - - postBuild = '' - rm -rf $out/bin - mkdir $out/bin - ln -s ${rofi-unwrapped}/bin/* $out/bin - rm $out/bin/rofi - - gappsWrapperArgsHook - makeWrapper ${rofi-unwrapped}/bin/rofi $out/bin/rofi \ - ''${gappsWrapperArgs[@]} \ - --prefix XDG_DATA_DIRS : ${hicolor-icon-theme}/share \ - ${lib.optionalString (plugins != []) ''--prefix XDG_DATA_DIRS : ${lib.concatStringsSep ":" (lib.forEach plugins (p: "${p.out}/share"))}''} \ - ${lib.optionalString (theme != null) ''--add-flags "-theme ${theme}"''} \ - ${lib.optionalString (plugins != []) ''--add-flags "-plugin-path $out/lib/rofi"''} - - ${lib.optionalString symlink-dmenu "ln -s ${rofi-unwrapped}/bin/rofi $out/bin/dmenu"} - - rm $out/bin/rofi-theme-selector - makeWrapper ${rofi-unwrapped}/bin/rofi-theme-selector $out/bin/rofi-theme-selector \ - --prefix XDG_DATA_DIRS : $out/share - ''; - - meta = - rofi-unwrapped.meta - // { - priority = (rofi-unwrapped.meta.priority or 0) - 1; - }; -}