Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmobar: tzdata patch #73510

Closed

Conversation

emmanuelrosa
Copy link
Contributor

The DateZone xmobar plugin uses the hard-coded path /usr/share/zoneinfo
for timezone information. This change patches DateZone.hs to replace the
path with ${pkgs.tzdata}/share/zoneinfo, thus the correct path is set
at compile-time.

Closes #73152

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @


# The DateZone xmobar plugin has the hardcoded path /usr/share/zoneinfo
xmobar = overrideCabal super.xmobar (drv: {
preConfigure = "sed -i -e s,/usr/share/zoneinfo,${pkgs.tzdata}/share/zoneinfo, src/Xmobar/Plugins/DateZone.hs";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like in nixpkgs, people try to use substituteInPlace instead of sed directly.

Could you change this to use substituteInPlace? If you grep through nixpkgs, you should be able to find a bunch of examples of it being used.

@cdepillabout
Copy link
Member

cdepillabout commented Nov 17, 2019

@emmanuelrosa Thanks for this fix!

Could you create an issue on the xmobar issue tracker saying that we would like an officially supported way of changing the path to zoneinfo? Maybe like a command line flag or environment variable so we could set it at runtime. Or they could provide us with a configure flag that we could set at compile time with --ghc-option=-DZONEINFO_PATH.

Also, I just checked on my system, and it looks like there is a TZDIR environment variable defined. Maybe that is a well-supported thing in the Linux ecosystem? Maybe xmobar could just use that?

And then please link to this issue in a comment in the pkgs/development/haskell-modules/configuration-nix.nix file.

@emmanuelrosa
Copy link
Contributor Author

I submitted a fix upstream, using TZDIR: https://github.com/jaor/xmobar/pull/411

@@ -636,4 +636,9 @@ self: super: builtins.intersectAttrs super {
# need it during the build itself, too.
cairo = addBuildTool super.cairo self.buildHaskellPackages.gtk2hs-buildtools;
pango = disableHardening (addBuildTool super.pango self.buildHaskellPackages.gtk2hs-buildtools) ["fortify"];

# The DateZone xmobar plugin has the hardcoded path /usr/share/zoneinfo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting the fix upstream!

Please edit this comment to link to https://github.com/jaor/xmobar/pull/411 so that the nixpkgs haskell maintainers know when this can be removed.

(Or you could just close this PR and wait for an upstream release to fix this problem...)

The DateZone xmobar plugin uses the hard-coded path /usr/share/zoneinfo
for timezone information. This change patches DateZone.hs to look up the
zoneinfo path in the TZDIR environment variable.

Closes NixOS#73152
@emmanuelrosa
Copy link
Contributor Author

Until upstream releases xmobar 0.32, here's an example of a nixpkgs overlay to install xmobar from upstream's Git master branch:

self: super: 
{
  xmobar = super.xmobar.overrideAttrs (oldAttrs: rec {
    name = "xmobar-git";

    src = self.fetchFromGitHub {
      owner = "jaor";
      repo = "xmobar";
      rev = "c175588099632c474f988fb4a61ab51ad2523975";
      sha256 = "0z6j9i48ll58wlmvllj5mi9k8p4mgpylnsj9mbilmah1bhs192qi";
    };
  });
}

I'm now using the above instead of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xmobar - needs a patch to use the DateZone plugin
2 participants