-
-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
haskellPackages.xmonad_0_17_0: respect NIX_GHC and XMONAD_XMESSAGE
Adds xmonad-nix.patch adjusted for xmonad 0.17.0. Originally posted here: https://discourse.nixos.org/t/use-latest-version-of-xmonad-0-17-0/16191/5 Co-Authored-By: ento <ping@stillspinning.cc> Co-Authored-By: sternenseemann <sternenseemann@systemli.org>
- Loading branch information
1 parent
c85d141
commit 36d5761
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
pkgs/development/haskell-modules/patches/xmonad_0_17_0-nix.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
diff --git a/src/XMonad/Core.hs b/src/XMonad/Core.hs | ||
index 46a0939..92af53d 100644 | ||
--- a/src/XMonad/Core.hs | ||
+++ b/src/XMonad/Core.hs | ||
@@ -46,6 +46,7 @@ import Data.Traversable (for) | ||
import Data.Time.Clock (UTCTime) | ||
import Data.Default.Class | ||
import Data.List (isInfixOf) | ||
+import System.Environment (lookupEnv) | ||
import System.FilePath | ||
import System.IO | ||
import System.Info | ||
@@ -458,7 +459,8 @@ xfork x = io . forkProcess . finally nullStdin $ do | ||
-- | Use @xmessage@ to show information to the user. | ||
xmessage :: MonadIO m => String -> m () | ||
xmessage msg = void . xfork $ do | ||
- executeFile "xmessage" True | ||
+ xmessageBin <- fromMaybe "xmessage" <$> liftIO (lookupEnv "XMONAD_XMESSAGE") | ||
+ executeFile xmessageBin True | ||
[ "-default", "okay" | ||
, "-xrm", "*international:true" | ||
, "-xrm", "*fontSet:-*-fixed-medium-r-normal-*-18-*-*-*-*-*-*-*,-*-fixed-*-*-*-*-18-*-*-*-*-*-*-*,-*-*-*-*-*-*-18-*-*-*-*-*-*-*" | ||
@@ -654,8 +656,9 @@ compile dirs method = | ||
bracket (openFile (errFileName dirs) WriteMode) hClose $ \err -> do | ||
let run = runProc (cfgDir dirs) err | ||
case method of | ||
- CompileGhc -> | ||
- run "ghc" ghcArgs | ||
+ CompileGhc -> do | ||
+ ghc <- fromMaybe "ghc" <$> (lookupEnv "NIX_GHC") | ||
+ run ghc ghcArgs | ||
CompileStackGhc stackYaml -> | ||
run "stack" ["build", "--silent", "--stack-yaml", stackYaml] .&&. | ||
run "stack" ("ghc" : "--stack-yaml" : stackYaml : "--" : ghcArgs) |
36d5761
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This no longer applies to xmonad master since xmonad/xmonad@165e25f#diff-206141305e4cc4e20f2b6ee7b8b99b238c57cff3a9fa442848427958e4c64f63L48, can you folks please update the patch?
Alternatively, we might even accept such a change upstream, although we'd first need to understand under what circumstances these env vars can be set (not just in Nix, but in general).
Is there any precedent for any upstream carrying such a Nix-specific hack?
36d5761
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The patch is intended for xmonad 0.17, so it doesn't really make sense for us to update it before the next release (or rather before the next release hits stackage).
NIX_GHC
and related environment variables are set for synthesizedghcWithPackages
environments which create an environment in which a specific GHC and a certain list of installed Haskell packages are available.NIX_GHC
is used to let things that try to find the path / prefix of GHC know about the environment which is constructed by symlinking a lot of stuff into a new store path. Symlinking of course means that this environment path is not even known to GHC itself, hence the environment variable.However, in the case of xmonad this is actually not needed / used in this way since xmonad just needs to find the
ghc
executable to call to recompile itself andNIX_GHC
was probably used because the name was familiar:nixpkgs/nixos/modules/services/x11/window-managers/xmonad.nix
Lines 33 to 36 in 5837cc7
For nixpkgs it would be satisfactory if upstream xmonad could provide us with a way to set the path to the
xmessage
andghc
binaries called by xmonad via environment variables, e.g.XMONAD_XMESSAGE
andXMONAD_GHC
would be satisfactory. This is necessary because we can't necessarily (especially in the case of ghc) install them globally so that they are always available fromPATH
.36d5761
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sternenseemann
As of xmonad/xmonad@117583e we have done this now.
36d5761
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's great, thanks! I'll see that the xmonad module in nixpkgs is adjusted as soon.