taffybar: align flake inputs and drop local overlay patch

This commit is contained in:
2026-02-10 22:42:43 -08:00
committed by Kat Huang
parent ce25ccd975
commit 5bfb1a5884
4 changed files with 291 additions and 171 deletions

View File

@@ -48,22 +48,6 @@
"type": "github"
}
},
"dbus-menu_2": {
"flake": false,
"locked": {
"lastModified": 1770753441,
"narHash": "sha256-ycJexWPCSlLriDAouT3PvRnbwByeGF6bsQrvWcY1eGU=",
"owner": "taffybar",
"repo": "dbus-menu",
"rev": "83f914ab70485331f4e45945251557e5c7ea50fa",
"type": "github"
},
"original": {
"owner": "taffybar",
"repo": "dbus-menu",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@@ -136,7 +120,68 @@
},
"git-ignore-nix": {
"inputs": {
"nixpkgs": "nixpkgs_3"
"nixpkgs": [
"gtk-sni-tray",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"git-ignore-nix_2": {
"inputs": {
"nixpkgs": [
"gtk-strut",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"git-ignore-nix_3": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1762808025,
"narHash": "sha256-XmjITeZNMTQXGhhww6ed/Wacy2KzD6svioyCX7pkUu4=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "cb5e3fdca1de58ccbc3ef53de65bd372b48f567c",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"ref": "master",
"repo": "gitignore.nix",
"type": "github"
}
},
"git-ignore-nix_4": {
"inputs": {
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1762808025,
@@ -177,7 +222,24 @@
}
},
"gtk-sni-tray": {
"flake": false,
"inputs": {
"dbus-menu": [
"dbus-menu"
],
"flake-utils": [
"flake-utils"
],
"git-ignore-nix": "git-ignore-nix",
"gtk-strut": [
"gtk-strut"
],
"nixpkgs": [
"nixpkgs"
],
"status-notifier-item": [
"status-notifier-item"
]
},
"locked": {
"lastModified": 1770754698,
"narHash": "sha256-W5xZaZMeK5nLwrXvgh35Ko143qteLCTpCq4WwW93zcM=",
@@ -188,13 +250,20 @@
},
"original": {
"owner": "taffybar",
"ref": "master",
"repo": "gtk-sni-tray",
"type": "github"
}
},
"gtk-strut": {
"flake": false,
"inputs": {
"flake-utils": [
"flake-utils"
],
"git-ignore-nix": "git-ignore-nix_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1760550944,
"narHash": "sha256-S0saDsCA3aosU23jO5+jSXkbyrv7/C48o8GjsZrqF0I=",
@@ -205,7 +274,6 @@
},
"original": {
"owner": "taffybar",
"ref": "master",
"repo": "gtk-strut",
"type": "github"
}
@@ -227,6 +295,20 @@
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1666603677,
"narHash": "sha256-apAEIj+z1iwMaMJ4tB21r/VTetfGDLDzuhXRHJknIAU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "074da18a72269cc5a6cf444dce42daea5649b2fe",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1730768919,
"narHash": "sha256-8AKquNnnSaJRXZxc5YmF/WfmxiHX6MMZZasRP6RRQkE=",
@@ -242,7 +324,7 @@
"type": "github"
}
},
"nixpkgs_3": {
"nixpkgs_4": {
"locked": {
"lastModified": 1666603677,
"narHash": "sha256-apAEIj+z1iwMaMJ4tB21r/VTetfGDLDzuhXRHJknIAU=",
@@ -256,7 +338,7 @@
"type": "indirect"
}
},
"nixpkgs_4": {
"nixpkgs_5": {
"locked": {
"lastModified": 1770537093,
"narHash": "sha256-pF1quXG5wsgtyuPOHcLfYg/ft/QMr8NnX0i6tW2187s=",
@@ -274,7 +356,7 @@
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1747372754,
@@ -295,19 +377,30 @@
"dbus-hslogger": "dbus-hslogger",
"dbus-menu": "dbus-menu",
"flake-utils": "flake-utils",
"gtk-sni-tray": "gtk-sni-tray",
"gtk-strut": "gtk-strut",
"nixpkgs": "nixpkgs",
"status-notifier-item": "status-notifier-item",
"taffybar": "taffybar",
"xmonad": "xmonad"
}
},
"status-notifier-item": {
"flake": false,
"inputs": {
"flake-utils": [
"flake-utils"
],
"git-ignore-nix": "git-ignore-nix_3",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1770253964,
"narHash": "sha256-tBbdN+xJmxNEZZSXYUxvVEeldzEjoL8WA45h3xU9U4w=",
"lastModified": 1770628548,
"narHash": "sha256-VGe0+xkbxg4EUv+/YKbIrmQ+ZIfaOJlDnhMej6vCm/o=",
"owner": "taffybar",
"repo": "status-notifier-item",
"rev": "08294f53c666aa85375364d5e08e952aa7510991",
"rev": "194ebfeb13b37f64815ebea3298fad02f01fe6aa",
"type": "github"
},
"original": {
@@ -364,14 +457,22 @@
"taffybar": {
"inputs": {
"dbus-hslogger": "dbus-hslogger_2",
"dbus-menu": "dbus-menu_2",
"dbus-menu": [
"dbus-menu"
],
"flake-utils": "flake-utils_2",
"gtk-sni-tray": "gtk-sni-tray",
"gtk-strut": "gtk-strut",
"gtk-sni-tray": [
"gtk-sni-tray"
],
"gtk-strut": [
"gtk-strut"
],
"nixpkgs": [
"nixpkgs"
],
"status-notifier-item": "status-notifier-item",
"status-notifier-item": [
"status-notifier-item"
],
"weeder-nix": "weeder-nix",
"xmonad": [
"xmonad"
@@ -379,8 +480,8 @@
"xmonad-contrib": "xmonad-contrib"
},
"locked": {
"lastModified": 1770755513,
"narHash": "sha256-tlwUJhim0PEnNotIpCA45oz37wSAWY3f9gUnvaQtjzw=",
"lastModified": 1770791708,
"narHash": "sha256-cvIDcnKMvv2wVCqO9sC43s562zWRGivi5vCCJ4SYtCE=",
"path": "/home/imalison/dotfiles/dotfiles/config/taffybar/taffybar",
"type": "path"
},
@@ -430,8 +531,8 @@
"xmonad": {
"inputs": {
"flake-utils": "flake-utils_3",
"git-ignore-nix": "git-ignore-nix",
"nixpkgs": "nixpkgs_4",
"git-ignore-nix": "git-ignore-nix_4",
"nixpkgs": "nixpkgs_5",
"unstable": "unstable"
},
"locked": {

View File

@@ -2,11 +2,29 @@
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# Kept for compatibility with parent flakes that set `inputs.xmonad.follows`,
# and for taffybar's own flake inputs. We don't depend on xmonad.lib here.
xmonad.url = "github:xmonad/xmonad/master";
# Needed by gtk-sni-tray, but not (currently) provided by nixpkgs' haskellPackages.
dbus-menu = {
url = "github:taffybar/dbus-menu";
flake = false;
};
status-notifier-item = {
url = "github:taffybar/status-notifier-item";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
gtk-strut = {
url = "github:taffybar/gtk-strut";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
gtk-sni-tray = {
url = "github:taffybar/gtk-sni-tray";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.gtk-strut.follows = "gtk-strut";
inputs.status-notifier-item.follows = "status-notifier-item";
inputs.dbus-menu.follows = "dbus-menu";
};
# nixpkgs' dbus-hslogger is currently too old for taffybar.
dbus-hslogger = {
@@ -16,24 +34,75 @@
taffybar = {
url = "path:/home/imalison/dotfiles/dotfiles/config/taffybar/taffybar";
inputs.nixpkgs.follows = "nixpkgs";
inputs.gtk-sni-tray.follows = "gtk-sni-tray";
inputs.gtk-strut.follows = "gtk-strut";
inputs.status-notifier-item.follows = "status-notifier-item";
inputs.dbus-menu.follows = "dbus-menu";
inputs.xmonad.follows = "xmonad";
};
};
outputs = { self, flake-utils, taffybar, nixpkgs, xmonad, dbus-menu, dbus-hslogger }:
outputs = {
self,
flake-utils,
taffybar,
nixpkgs,
xmonad,
dbus-menu,
status-notifier-item,
gtk-strut,
gtk-sni-tray,
dbus-hslogger,
}:
flake-utils.lib.eachDefaultSystem (system:
let
hoverlay = final: prev: hself: hsuper:
{
pkgs = import nixpkgs {
inherit system;
overlays = [
# Taffybar's flake overlay provides a set of haskell fixes we rely on.
taffybar.overlays.default
];
config.allowBroken = true;
};
hOverrides = hself: hsuper: {
dbus-menu =
hself.callCabal2nix "dbus-menu"
(final.lib.cleanSource dbus-menu)
{ inherit (final) gtk3; };
pkgs.haskell.lib.overrideCabal
(hself.callCabal2nix "dbus-menu"
(pkgs.lib.cleanSource (dbus-menu.outPath or dbus-menu))
{ inherit (pkgs) gtk3; })
(_: { doCheck = false; doHaddock = false; });
status-notifier-item =
pkgs.haskell.lib.overrideCabal
(hself.callCabal2nix "status-notifier-item"
(pkgs.lib.cleanSource status-notifier-item.outPath)
{ })
(_: { doCheck = false; doHaddock = false; });
gtk-strut =
pkgs.haskell.lib.overrideCabal
(hself.callCabal2nix "gtk-strut"
(pkgs.lib.cleanSource gtk-strut.outPath)
{ })
(_: { doCheck = false; doHaddock = false; });
gtk-sni-tray =
pkgs.haskell.lib.overrideCabal
(hself.callCabal2nix "gtk-sni-tray"
(pkgs.lib.cleanSource gtk-sni-tray.outPath)
{ })
(_: { doCheck = false; doHaddock = false; });
dbus-hslogger =
hself.callCabal2nix "dbus-hslogger"
(final.lib.cleanSource dbus-hslogger)
(pkgs.lib.cleanSource (dbus-hslogger.outPath or dbus-hslogger))
{ };
taffybar = prev.haskell.lib.overrideCabal hsuper.taffybar (oa: {
# Build taffybar from our local flake input so it includes our extra
# modules (e.g. System.Taffybar.Widget.ASUS) used by this config.
taffybar = pkgs.haskell.lib.overrideCabal
(hself.callCabal2nix "taffybar" (pkgs.lib.cleanSource taffybar.outPath) { inherit (pkgs) gtk3; })
(oa: {
doHaddock = false;
doCheck = false;
# Legacy fix for older GHC (harmless on newer)
@@ -41,38 +110,39 @@
substituteInPlace src/System/Taffybar/DBus/Client/Util.hs \
--replace-fail "import Control.Monad (forM)" \
"import Control.Monad (forM)
import Control.Applicative (liftA2)"
import Control.Applicative (liftA2)"
'';
# Needed for gi-gtk-layer-shell (introspection data).
librarySystemDepends = (oa.librarySystemDepends or []) ++ [ pkgs.gtk-layer-shell ];
});
# gi-gtk-hs patching is now handled by taffybar's fixVersionNamePackages overlay
imalison-taffybar = prev.haskell.lib.addPkgconfigDepends (
imalison-taffybar = pkgs.haskell.lib.addPkgconfigDepends (
hself.callCabal2nix "imalison-taffybar"
(
final.lib.sourceByRegex ./.
["taffybar.hs" "imalison-taffybar.cabal"]
)
{ }) [
final.util-linux.dev
final.pcre2
final.pcre
final.libselinux.dev
final.libsepol.dev
final.fribidi.out
final.fribidi.dev
final.libthai.dev
final.libdatrie.dev
final.libxdmcp.dev
final.libxkbcommon.dev
final.libepoxy.dev
final.libxtst.out
(pkgs.lib.sourceByRegex ./. [ "taffybar.hs" "imalison-taffybar.cabal" ])
{ }
) [
pkgs.util-linux.dev
pkgs.pcre2
pkgs.pcre
pkgs.libselinux.dev
pkgs.libsepol.dev
pkgs.fribidi.out
pkgs.fribidi.dev
pkgs.libthai.dev
pkgs.libdatrie.dev
pkgs.libxdmcp.dev
pkgs.libxkbcommon.dev
pkgs.libepoxy.dev
pkgs.libxtst.out
];
};
defComp = { compiler = "ghc98"; };
overlay = xmonad.lib.fromHOL hoverlay defComp;
overlayList = [ taffybar.overlays.default overlay ];
in flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; overlays = overlayList; config.allowBroken = true; };
hpkgs = pkgs.lib.attrsets.getAttrFromPath (xmonad.lib.hpath defComp) pkgs;
# Avoid depending on xmonad.lib's helper functions, since parent flakes
# can override the xmonad input via `follows` and change that API.
hpkgs = pkgs.haskell.packages.ghc98.override (old: {
overrides = pkgs.lib.composeExtensions (old.overrides or (_: _: { })) hOverrides;
});
in
{
devShell = hpkgs.shellFor {
@@ -93,12 +163,13 @@ import Control.Applicative (liftA2)"
fi
'';
};
defaultPackage = hpkgs.imalison-taffybar;
}) // {
inherit overlay;
}
) // {
overlays = {
default = overlay;
# Provide access to taffybar's overlay for callers that want it.
taffybar = taffybar.overlays.default;
};
} ;
};
}

View File

@@ -6,59 +6,7 @@ makeEnable config "myModules.taffybar" false {
if builtins.isList taffybar.overlays
then taffybar.overlays
else builtins.attrValues taffybar.overlays
) ++ [
(final: prev: {
haskellPackages = prev.haskellPackages.override (old: {
overrides = prev.lib.composeExtensions (old.overrides or (_: _: {})) (hself: hsuper: {
taffybar = prev.haskell.lib.overrideCabal hsuper.taffybar (oa: {
postPatch = (oa.postPatch or "") + ''
patch -p1 <<'PATCH'
diff --git a/src/System/Taffybar/Widget/HyprlandWorkspaces.hs b/src/System/Taffybar/Widget/HyprlandWorkspaces.hs
index 8e0e07a..a40b1a6 100644
--- a/src/System/Taffybar/Widget/HyprlandWorkspaces.hs
+++ b/src/System/Taffybar/Widget/HyprlandWorkspaces.hs
@@ -27,7 +27,7 @@ import Control.Monad.IO.Class (MonadIO(liftIO))
import Control.Monad.Trans.Reader (ReaderT, ask, runReaderT)
import Data.Aeson (FromJSON(..), eitherDecode', withObject, (.:), (.:?), (.!=))
import Data.Char (toLower)
-import Data.List (foldl', sortOn, stripSuffix)
+import Data.List (foldl', sortOn, stripPrefix)
import Data.Maybe (fromMaybe, listToMaybe, mapMaybe)
import qualified Data.Map.Strict as M
import qualified Data.MultiMap as MM
@@ -42,12 +42,11 @@ import StatusNotifier.Tray (scalePixbufToSize)
import System.Environment.XDG.DesktopEntry
( DesktopEntry
, deFilename
- , getDirectoryEntriesDefault
- , getImageForDesktopEntry
+ , getDirectoryEntriesDefault
)
import System.Taffybar.Context
import System.Taffybar.Util
import System.Taffybar.Widget.Generic.AutoSizeImage (autoSizeImage)
-import System.Taffybar.Widget.Util (buildContentsBox, widgetSetClassGI)
+import System.Taffybar.Widget.Util (buildContentsBox, getImageForDesktopEntry, widgetSetClassGI)
import System.Taffybar.WindowIcon (getWindowIconFromClasses, pixBufFromColor)
@@ -316,6 +315,10 @@ normalizeAppId :: String -> String
normalizeAppId name =
let stripped = fromMaybe name (stripSuffix ".desktop" name)
in map toLower stripped
+
+stripSuffix :: Eq a => [a] -> [a] -> Maybe [a]
+stripSuffix suffix xs =
+ reverse <$> stripPrefix (reverse suffix) (reverse xs)
getWindowIconFromDesktopEntryByAppId ::
Int32 -> String -> TaffyIO (Maybe Gdk.Pixbuf)
PATCH
'';
});
});
});
})
];
);
environment.systemPackages = [
inputs.imalison-taffybar.defaultPackage.${pkgs.stdenv.hostPlatform.system}